On Sat, 06 Jan 2001 13:09:47 -0500, Dan Sugalski wrote:
>Okay, here's a big question that ties the two major pains we have in perl
>6--how do we tie threads and events together?
>
>* Can all events be delivered to any thread?
Yes, but in practice events probably would only be delivered to
threads that were listening for them. Signal events are different
beasts, though, although you could consider C<local $SIG{INT} =
\&handler;> as listening for an event.
>* Will events be delivered only to the thread that caused them? If so, what
>about threadless events? (Say, signals from the outside world)
Not necessarily. Events can be a useful way to pass messages between
threads. It might be fun to say:
post( $thread, event_name => @args );
Signals are different. I've written in Perl an event driven thread
dispatcher which has two different signal delivery modes. To its best
of its ability, it dispatches SIGPIPE to the thread where it was
generated. Everything else is propagated to every thread.
Some signals, like SIGINT, are terminal. Threads that don't handle
them are shut down. You can get situations where some threads shut
down on SIGINT and others continue running, perhaps to save things.
>* Should events be filtered into multiple event queues? If so, how do we
>say which goes where?
I've worked out some of this for a 5005threads-aware version of my
dispatcher. The prototype I wrote uses one queue per thread. Events
destined for a particular callback go to the thread where that
callback lives.
>* Should async events see any state at all, or should they live in a Safe
>compartment (or something like it)?
This wasn't an issue in my dispatcher. I had intended to go the route
of a higher-level language written in terms of hidden asynchronous
I/O (event driven threads). All language-level I/O would appear
synchronous, except for signals, which are, again different beasts.
>Opinions? Now's the time when we must address this, so better weigh in with
>opinions before I choose... :)
The thread-aware prototype is at <http://poe.perl.org/poe2/>.
current-snapshot.tar.gz in that directory is a tarball of the whole
tree. Design notes are in Readme, the notes directory, and source
comments.
-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net