in reply to One piece of code, two mysteries! (UPDATED.)
These 2 lines confuse me
What are you trying to do here? It appears, that you repeat sleep(1) until $timeout is 0. In this case, the second line does nothing, so your thread is not terminated. Probably you wanted to havekill 0, $pid while sleep 1 and $timeout--; kill 3, $pid if $timeout;
sleep 1 while kill(0, $pid) && $timeout--; kill 3, $pid if $timeout;
Could it be, that running thread messes up the array?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: One piece of code, two mysteries!
by BrowserUk (Patriarch) on Oct 05, 2012 at 07:43 UTC |