Signal handlers and context switching?

From: Date: Wed, 16 Aug 2000 07:11:32 +0000
Subject: Signal handlers and context switching?
Groups: php.dev 
Request: Send a blank email to php-dev+get-29099@lists.php.net to get a copy of this message
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. The most complex of the problems in getting such a function to work properly when a signal is received is the ability to make transparent context switches -- interrupting one function, doing things within another function, and then completing the function which was executing previously. Unfortunately, I'm not sure where to begin with swapping execution contexts without crashing PHP and leaving myself half a dozen core dumps (which I'll already have anyway, with a few dozen bruises on my forehead in the process), as I know that trying to simply do 'call_user_function()' from within the signal handler in C will break everything horribly - I tried it once before, by calling the user function that I wanted to call directly out of the signal handler. I believe PHP segfaulted upon my calling the signal handler, because the execution state was not at all what the parser/executor was expecting to run into, and so it hurled all over the place. Does anyone have half a clue about how to begin going about this? Thanks, Chris

« previous php.dev (#29099) next »