develooper Front page | perl.perl6.internals | Postings from August 2001

Re: Opcode Dispatch

Thread Previous
From:
Dan Sugalski
Date:
August 6, 2001 14:58
Subject:
Re: Opcode Dispatch
Message ID:
5.1.0.14.0.20010806175530.0234cd98@tuatha.sidhe.org
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
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About