Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes: > You can try this; test against git next of Automake. > However, it also causes a hang on Cygwin, so there may be an independent > bug (in the test or in perl); the lock() called from the thread seems to > never complete.
Hmm. On some systems flock(2) is documented as being per-process only (that is, you can't lock a file from yourself in a multi-threaded app[1]). I'm not sure if flockfile(3) (at the FILE*) level, or fcntl(2)/lockf() at the fd level, do any better, but that doesn't matter since perl's flock states that whether it was implemented with flock or fcntl depends on how perl was configured. [1] http://www.mydatabasesupport.com/forums/solaris/362139-file-locking- solaris.html Therefore, is this test even valid, since you did it via perl threads as opposed to independent processes? But the point remains that we DO want perl's flock to work for cross-process locking (automake and autoconf both need a lock on autom4te.cache/requests, to block whichever task starts late). -- Eric Blake
