[Note: parts of this message were removed to make it a legal post.]
BTW, do you hang on IRC? #ruby-lang, seydar.
I'm typically on #rubinius and #erlang, tarcieri
So I need to do the Actor.sleep to dish out control, but how come I
didn't have to do that with the version of revactor actually released?
The semantics of how Actors are scheduled changed slightly in trunk.
Previous versions of Revactor would return control back to the root Actor /
Fiber in the event that all inter-Actor messages had been dispatched and
there were no pending network events. The trunk version adds a thread-safe
message queue to allow Actors in one thread to send messages to Actors in
another thread, and implementing this required a number of changes to the
semantics of the scheduler.
There was a nasty idle loop bug in previous versions of Revactor, as well.
If you load Revactor 1.2, and call something to the effect of
Actor.receive{ |f|
f.when
foo) {} } in the root Actor, the scheduler will just sit and spin,
because all messages have been dispatched and there are no event sources.
Infinite loop.
The new scheduler semantics make use in irb (or in RSpec) a bit more
cumbersome, but they add thread safety, a ~10% performance improvement (per
tools/messaging_throughput.rb), and eliminate a potential infinite loop.
And that infinite loop isn't just hypothetical: you'll encounter it in any
system which has run out of events to process, and it will immediately get
in the way when implementing distributed systems which need to wait for
remote events.
Next release or next svn update? I'm running the svn version.
The next release. The svn version has the thread-safety improvements in
place, but they're not speced yet and are definitely buggy. I wouldn't try
using them yet, but you won't encounter any problems unless you try to send
messages between Actors across threads. The idle loop bug is also fixed.