apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: fcntl based mutex on Solaris/EM64T
Date Mon, 20 Aug 2007 15:46:50 GMT

On Aug 20, 2007, at 11:23 AM, Jeff Trawick wrote:

> On 8/19/07, Eric Covener <covener@gmail.com> 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...
%


Mime
View raw message