Instruct ICC wrote: >>> Greetings everyone, I was wondering where I could find information on the >>> status and possibilities of threads being included in PHP. Or if you are >>> knowledge-able on the status of threads, if it is a planned addition or not >>> and the reasons as such. I understand PHP is not thread safe, that the core >>> is thread safe but many required extensions are not. Is there a road map to >>> this? >> Being thread safe and being able to use threads are two different things. >> >> PHP 5 *is* thread safe, but a great many extensions are not. >> >> PHP is never likely to support threads. Remember that the majority of >> PHP usage is in the context of web requests. There are a great many >> issues the crop up when you consider adding threading to an Apache >> module, and I'm sure the same is true of most of the other SAPIs. >> >> Hope that helps. > > Hmm. I was looking into proc_open and pcntl_fork as a way to have a "Manager > application" handle "Worker applications" (or worker threads -- so to speak). > > Actually as a quick way to develop in PHP instead of C++. Some of the worker > processes are actually C++ and some are PHP. > > Can anyone expound on these alternatives to threads? I'm assuming that > neither "blocks" execution of the spawned process. Is it merely the > difference between processes and threads whereas threads have less overhead? > This is for a command line PHP-GTK app (the Manager Application) and I'm not > too concerned about running out of resources. > > I noticed the proc_* methods allow for getting the status and maybe the > manager will kill off some workers if they do not behave as desired.
proc_* will give you complete control over spawned/child processes at the OS level. overhead is not the only difference, but for your practical purposes child process spawning will cover your bases. > _________________________________________________________________ > Help yourself to FREE treats served up daily at the Messenger Café. Stop by > today. > http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php