Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::interprocess] named_recursive_mutex lock owner identification
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2014-08-14 07:45:53


El 13/08/2014 9:29, Frank Bergemann escribió:
> I am using boost 1.47 on linux/solaris(/hpux).
> Can you please tell me, how to find out the lock owner of a mutex
> (named_recursive_mutex) ?
> (in case i can't equire the lock within a timeout).
> In posix' pthread_mutex_t there is a
> int __owner;
> which holds the thread id (gettid())
> But i can't find it in boost::interprocess.
> Ok. there might be different base implementations for mutex/threads/etc.
> But is there a "boost ID", that can be logged by application using boost
> which might be a linux/unix thread id, but maybe something else?
> - many thanks!
> best regards,
> Frank

Hi,

Boost.Interprocess has no why to tell you this. "__owner" is not POSIX,
but an implementation detail of the type pthread_mutex_t in your
platforms. In those platforms, probably Boost.Interprocess builds a
process-shared recursive mutex in shared memory (follow
named_recursive_mutex constructor to see where it's built) of the type
pthread_mutex_t. Maybe you can use the implementation details of your
platform to obtain the ID.

Best,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net