In general you should avoid the serialize stuff; it has been found that we can't pre-parse libraries and have them reliably be usable in future runtimes. This is primarily because various tokens are handled differently depending on when they are encountered in the code. For example, if a parse happens at the top-level and a variable is encountered, it is treated a a local variable. If that same code (perhaps being eval'ed) is parsed within a block, the variable will be a dynamic variable.

Serialization is in general broken. Do not use it.

On 5/25/06, Evan Buswell <[EMAIL PROTECTED]> wrote:
Using the JRuby serialize ant task on some of my own code, I stumbled into
this:

  $stderr.puts "Thread 1: 1"
  s = Thread.new do
    $stderr.puts "Thread 2: 1"
    sleep(5)
    $stderr.puts "Thread 2: 2"
  end
  $stderr.puts "Thread 1: 2"
  sleep(5)

Running this w/o serialize gives:

Thread 1: 1
Thread 2: 1
Thread 1: 2
Thread 2: 2

As expected, but when this is serialized, I get:

Thread 1: 1
Thread 2: 1
[sleeping]
Thread 2: 2

It looks as if serialized code implies single-threading, is this by
design?  Is there any way around it?

Evan




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmdlnk&kid7521&bid$8729&dat1642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel



--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com

Reply via email to