Btw, it looks to me that proper unlink argument should be $SEMAPHORE.
In reply to Re: Race conditions by happy.barney in thread Race conditions by toniax