At 05:47 PM 8/6/2001 -0400, Bryan C. Warnock wrote:
>I was doing some thinking on the event loop (and how to tie it in later),
>and ran into a question.  Given the current priority idea, how far does a
>priority stretch?  (Horrible description, so let me give an example.  Say
>SIGALRM has been determined to be priority 4 and you are processing regular
>code (prioirity 0).  Perl receives the signal and generates an event of
>prioirty 4.  Perl then switches to that priority level to process the event.
>If the event has a callback (to regular Perl code), does the callback's code
>(beyond the actual dispatch) run at PRI 4, or 0?  At what point do you
>revert to the lower priority and allow other events to be handled?)

Event handlers run at their priority until they finish. Any code that needs 
to run at a different priority level needs to be queued up as a set of 
events themselves. So if you're running at IPL 12, say, and need to run 
code at IPL 4, you'd do a:

    fire_event(\&code, 4);

or something like it.

Pretty much the same as you'd do with any other sort of interrupt/event 
handling. (Though I do realize that a lot of people haven't done this sort 
of thing, at least not as much as us old-timers...)

                                        Dan

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

Reply via email to