|laziness, impatience, and hubris|
How I'm sure syswrite has finished?by casiano (Pilgrim)
|on Mar 14, 2009 at 11:58 UTC||Need Help??|
casiano has asked for the
wisdom of the Perl Monks concerning the following question:
I have a race-condition problem.
The problem arises because a child process makes a call to
and finishes. The message is huge and is received by another process running on a remote machine (via SSH). I thought closing the handler would be enough to sync but it does not seem to work. The fragment of code is as follows (I'm using Parallel::ForkManager but the problem arises also with plain fork)
The problem disappears if I insert a sleep(1) after the syswrite call because the sleep gives time for the write to complete. Is there a way to know when the call to syswrite has fully finished?
Thanks for your help