A mutex for inter-process ;-)
rrs at lakerest.net
Mon Mar 30 16:29:22 PDT 2009
On Mar 30, 2009, at 5:16 PM, Xin LI wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Randall Stewart wrote:
>> Hi all:
>> I have recently written a small set of routines that allow
>> two process to have a "mutex" between them.. actually it allows
>> all of the threads in any set of processes to have mutexes between
>> themselves ;-)
>> Anyway it seems to be working fairly well.. I still have to write a
>> for it (documentation always last).. and eventually I would like to
>> port in
>> some of the WITNESS type features since the mutex's have names..
>> I probably should also think about scaling it up a bit.. right now
>> more for a small scale (100 or less mutexes)...
>> Who should I talk to about getting this in... having it reviewed
>> etc. I
>> it belongs in libthr since it really needs the tid of the pthreads
>> from the
>> pthread_t type... and for now I have a horrible hack in to get it ;-)
> 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.
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 one can call it whenever one
I will ping Julian and the others...
> - --
> Xin LI <delphij at delphij.net> http://www.delphij.net/
> FreeBSD - The Power to Serve!
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.11 (FreeBSD)
> -----END PGP SIGNATURE-----
More information about the freebsd-threads