[PHP] Can I fork a PHP thread?

2001-01-17 Thread Dylan McNamee

There are occasions when I'd like to execute some long-running task
in the background, in response to some user action.  It seems that
PHP has all the neccesary mechanisms to allow me to do this, but
in my perusing of the manuals/FAQ's/digests, etc, I don't see such 
a facility.  

For example, I'd like to do something like this:

function long_running_background_task() 
{
...
}

function handle_some_action() 
{
...
fork (long_running_background_task);
}

In the cases I'd like to do this, I can manage synchronization
externally...
(i.e., implement join by waiting for a /tmp file to appear or
something),
so I'm not asking for a join, or any sychronization facilities.

Does anyone agree that this would be useful?  Is there another way to
accomplish this? Better yet, does this function already exist, but has
managed to hide for all this time...?

thanks,
dylan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Stack trace function would be really useful!

2001-01-22 Thread Dylan McNamee

Back in my rough-and-ready PHP days, I used to report runtime errors
using include("some long description of the error");, which would
report:

file "some long description of the error" not found in foo.php line 32.

Which is great for developers, but awful if a Real User ever sees it.

So, lately I've been using a function, handleException(String
errorType), 
which draws a nice page describing gently that something has gone wrong,
etc. Unfortunately this way can't report the line number of the function
that called it and I'd rather not have to manually include that info 
at each calling site.  

If there was a PHP function that printed out the call-stack, I'd be
totally set.  Is there such a function (I looked, but perhaps with the
wrong keywords), or if not, could it be easily added?  

thanks,
dylan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]