At 11:18 AM -0700 5/11/04, chromatic wrote:
On Tue, 2004-05-11 at 10:45, Dan Sugalski wrote:

 That'll still need some C. The event system as it stands is all
 active--all event sources put events into the system, rather than
 having the event system go looking at event sources for events. You'd
 either need to queue up regular timer events to go check for new
 stuff or have a thread actively polling the source for events and
 throwing them into parrot's event queue.

The thread seems like the way to go, if I can enqueue an event without writing any C -- just post EventPMC from PASM?

So for SDL, I'd start a separate thread that blocks on SDL_WaitEvent,
creating and posting events when they happen.  My main program would
handle the events as normal Parrot events.  Standard producer consumer
stuff.

Since it's blocking, it won't eat up too many resources -- that's nice.
It'd be nice to have the SDL event thread ignore events I don't care
about though, instead of creating event PMCs I'll just throw away later.

You can always Get Horribly Clever in the event handling thread and look at what the SDL library's handed you. If it's uninteresting you can just throw it away rather than creating an event to be discarded.


Is this what you have in mind?

Yep. -- Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to