Re: Starting a background process and reporting failure if applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is this for a background task or a background process? The two terms often are used such that tasks exist within processes and shares resources with the other tasks in the process and processes are in separate address spaces and their resources are protected from other processes.

What you are describing using shared memory is what an event would be in Windows and Unix/Linux. An event is something that the calling process/task would create and pass to the process/task. The process/task would signal the event when relevant. The calling process/task could either check to see if the event is signaled or wait for the event to be signaled. For processes (inter-process communication) the event would need to be named; for intra-process (tasks) communication an event could be passed in the same manner that objects are passed. So using an event there would be no need to wait a second; the calling process/task could wait for the other process/task to signal.

I am not experienced with PHP but I found PHP: SyncEvent - Manual that sounds like it does exactly what I am describing.


Arno Kuhl wrote:
The idea would be for the background task to set a flag in shared memory showing it had started successfully, and the parent process could check for that flag to confirm the background task/s had started, if it times out after a second then the background failed to start.  Obviously once it’s running it can set values as well to show progress of the background task/s.


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux