Bug 38758 - process mutex trylock functions for unix
Summary: process mutex trylock functions for unix
Status: RESOLVED FIXED
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: All other
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: PatchAvailable
: 43752 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-22 22:36 UTC by Chris Darroch
Modified: 2008-04-07 03:31 UTC (History)
1 user (show)



Attachments
adds trylock functions for unix process mutexes (4.88 KB, patch)
2006-02-22 22:36 UTC, Chris Darroch
Details | Diff
test program for lock functions (2.40 KB, text/x-csrc)
2006-02-22 22:38 UTC, Chris Darroch
Details
test program for trylock functions (2.62 KB, text/x-csrc)
2006-02-22 22:39 UTC, Chris Darroch
Details
results of testing on solaris and linux (786 bytes, text/plain)
2006-02-22 22:39 UTC, Chris Darroch
Details
adds trylock functions for unix process mutexes (4.88 KB, patch)
2006-03-12 19:58 UTC, Chris Darroch
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Darroch 2006-02-22 22:36:11 UTC
Years ago I wrote to the APR mailing list about the missing trylock functions in
locks/unix/proc_mutex.c, and since then I've just been patching APR to make what
I needed available:

http://marc.theaimsgroup.com/?l=apr-dev&m=103004616828872&w=2

I finally sat down and wrote out a full set of trylock functions; see the
attached patch.  I'm hoping they can be added to APR!  :-)  I've tested them on
Solaris and Linux, but other Unixes should probably be checked as well.  I've
supplied two test programs for doing that.

In my original email thread, Aaron Bannert and I briefly discussed the issue of
what happens when a lock is acquired by a process and then that process dies. 
For reference, I did some testing and I'll include my results as an attachment.
   The interesting new development in this field is described here, namely that
Linux support for robust pthread mutexes may be "coming real soon":

http://lwn.net/Articles/172134/
Comment 1 Chris Darroch 2006-02-22 22:36:49 UTC
Created attachment 17769 [details]
adds trylock functions for unix process mutexes
Comment 2 Chris Darroch 2006-02-22 22:38:02 UTC
Created attachment 17770 [details]
test program for lock functions
Comment 3 Chris Darroch 2006-02-22 22:39:09 UTC
Created attachment 17771 [details]
test program for trylock functions

If my trylock implementations are merged, let me know and I'll rewrite this
test program to fit into the APR test suite, a la test/testprocmutex.c.
Comment 4 Chris Darroch 2006-02-22 22:39:41 UTC
Created attachment 17772 [details]
results of testing on solaris and linux
Comment 5 Chris Darroch 2006-03-12 19:58:46 UTC
Created attachment 17878 [details]
adds trylock functions for unix process mutexes

initial patch was reversed
Comment 6 Joe Orton 2006-03-13 11:46:05 UTC
This looks good, thanks a lot Chris; I've committed it with a few minor tweaks:

http://svn.apache.org/viewcvs?rev=385523&view=rev

An addition to the testsuite would be great too.
Comment 7 Joe Orton 2008-04-07 03:31:15 UTC
*** Bug 43752 has been marked as a duplicate of this bug. ***