Re: Signal handlers and context switching?

From: Date: Wed, 16 Aug 2000 20:25:53 +0000
Subject: Re: Signal handlers and context switching?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-29194@lists.php.net to get a copy of this message
Hello Chris, On 16-Aug-00 04:11:32, you wrote: >An interesting idea, though I have no clue how feasible it is. I'd like to >implement a signal() function for PHP, and I realize there's a lot of >things that I would have to do for it to even work without bringing >everything to a complete halt. I don't think you can do anything inside a signal function handler other than just setting some global variables because in some platforms signal handler are even called from real CPU interrupt handler functions. What I suggest that you is to implement something that PHP doesn't have that is a sort of event loop within which resources are polled to process any actions that should be taken on the user space. You may need to implement a sort of generic message queue to get events processed in the right chronological order. You may need to use some resource access control like semaphores to prevent simultaneous access to the message queue. Some day, when PHP finally supports threads like any modern language (say Perl, Java, etc...) inter process message passing will be essential and simultaneous access resource control will have to work right. You should not be posting messages to a queue from signal interrupt handlers though. If you need inspiration on these topics, you may want to look into X Toolkit for an example of a portable implementation of message queues. Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.dev (#29194) next »