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/
Created attachment 17769 [details] adds trylock functions for unix process mutexes
Created attachment 17770 [details] test program for lock functions
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.
Created attachment 17772 [details] results of testing on solaris and linux
Created attachment 17878 [details] adds trylock functions for unix process mutexes initial patch was reversed
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.
*** Bug 43752 has been marked as a duplicate of this bug. ***