On Aug 20, 2007, at 11:23 AM, Jeff Trawick wrote:
On 8/19/07, Eric Covener <[EMAIL PROTECTED]> wrote:A thread in proc1 will get EDEADLK from fcntl() on the LDAP mutex A potential for deadlock occurs if a process controlling a locked region is put to sleep by attempting to lock another process' locked region. If the system detects that sleeping until a locked region is unlocked would cause a deadlock, fcntl() will fail with an EDEADLK error.sounds like process-wide locks such as fcntl() aren't intended for this type of use somewhat-simple testcase attached ./a.out lock1 15 lock2 & ./a.out lock2 3 lock1 first process spits out "lock2: Deadlock situation detected/avoided" haven't tried on any platforms besides Solaris 10 <testfcntl.c>
Assuming I ran it correctly, no prob with OS X (10.4.10): % cat la ./a.out lock1 15 lock2 & ./a.out lock2 3 lock1 % sh la Opening lock1... Locking lock1... Sleeping 100 seconds... Opening lock2... Locking lock2... Sleeping 100 seconds... Sleeping 100 seconds in main... Opening lock1... Locking lock1... Sleeping 100 seconds in main... Opening lock2... Locking lock2... Sleeping 100 seconds... %
