This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: glibc -- ISO C11 threads Proposal


On 31/03/14 10:18, Rich Felker wrote:
> On Mon, Mar 31, 2014 at 09:48:29AM -0400, Kevin Cox wrote:
>> On 31/03/14 01:50, Rich Felker wrote:
>>>
>>> I realized there's an alternate solution to the problem for
>>> non-process-shared mutexes: simply keep a count of recursive or
>>> error-checking mutexes the current thread owns in its TLS. If, on
>>> exit, this count is nonzero, don't actually exit but instead leave the
>>> tid permanently tied up until the process exits. (This requires
>>> emulating thread exit for pthread_join to work.)
>>>
>>
>> Instead of hanging the thread could the mutex be put in a "permalocked"
>> state?  For example maybe the stored thread id could be replaced will a
>> "null" thread id.  This would require reaching into pthread internals
>> (assuming we use pthreads to back C11) but this way you can let the
>> thread die as the user would expect but the mutex would stay locked forever.
> 
> That's the solution which requires space to track all locks held in a
> linked list, the "non-alternate" solution.

Ah, yes.  I missed that yours was only keeping a count.


Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]