in reply to Does Semaphore Work?
in thread Safe Counter
Are you use-ing strict, warnings, and Fcntl ':flock' ? If you call flock while LOCK_EX is seen as undef or zero (in numeric context), you won't get the effect you want, and the semaphore will indeed fail silently.
$ perl -e'print +LOCK_EX, $/' LOCK_EX $ perl -e'print 0+LOCK_EX, $/ 0 $ perl -Mwarnings -e'print 0+LOCK_EX, $/' Argument "LOCK_EX" isn't numeric in addition (+) at -e line 1. 0 $ perl -Mstrict -Mwarnings -e'print 0+LOCK_EX, $/' Bareword "LOCK_EX" not allowed while "strict subs" in use at -e line 1 +. Execution of -e aborted due to compilation errors. $ perl -Mstrict -Mwarnings -MFcntl=:flock -e'print 0+LOCK_EX, $/' 2 $
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Does Semaphore Work?
by theorbtwo (Prior) on May 07, 2004 at 05:27 UTC |