amal/CThread — Issue #4: SIGCHLD and Results error
Author: OlegLMP
Created: 2012-01-16 12:38:54+00:00
State: open

Place in process() function external call like this:

protected function process()
{
`echo 1`; // <<<< this
return $this->getParam(0);
}

Then start simple example with one thread
Output:

Simple example with one thread
result: 0
error
result: 2
result: 1 <----- result 1 coming instead of 3!
result: 3 <----- result 3 coming instead of 4!
result: 4 <----- result 4 coming instead of 5!
result: 5 <----- etc
result: 6
result: 7
result: 8
<----- result 9 not coming!

After first job thread caught SIGCHLD (17) signal and die (its not error, need rigister this signal and write handler)
But as you can see when thread dies, its result continue stay in some buffer and coming as results on other jobs - its error.