A mutex for inter-process ;-)

Julian Elischer julian at elischer.org
Mon Mar 30 18:05:33 PDT 2009

Randall Stewart wrote:

>> I think davidxu@ deischen@ and julian@?
>> BTW.  How do you handle with one process exit (abnormally) without
>> releasing the mutex?  Just curious :)
> I have a couple of ways of dealing with this..

> 1) Of course the initialization routine calls atexit() to get a
> "cleanup  handler" in place.

this is not really sufficient for a system supplied service.

> 2) Often times, of course, this can fail e.g. you get a SIGSEGV..
> or some such. When you attach the memory, an audit is done. The
> audit will validate that the pid is still alive and has the
> particular tid in it. Of course this is not 100% but as long as the
> tid's have not rolled over it should work. The function is also
> public (need to add that and many things to the manual pages ;-D)
> so that onecan call it whenever one wants :-)

TIDs do roll over the last I looked.. (this may have changed)

did you say man page?  goodie..
lets' see it..

There have been a lot of IPC and mutex implementations
but the trick always comes with the requirement
that they handle process/thread death.

David has done some recent work in this space..

> I will ping Julian and the others...

More information about the freebsd-threads mailing list