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]

AW: Specific Linux syscalls for glibc API


On 18-11-2015 14:32, Rich Felker wrote:

> It should be noted that there are some serious caveats to using tids
> directly. Unlike pthread_t, a tid is immediately freed and available
> for reuse as soon as the thread exits. This means additional
> synchronization with the target thread's exit is required to avoid
> TOCTOU races when use them.

I'm not sure if I really got your point here. While there is no doubt that
synchronization _is_ needed if a tid must never be used after it has become
invalid (due to the exit of its related thread), I don't see much of a risk
that a tid value might be reused by a newly created thread any time soon:
AFAIK, newly allocated tids are, like pids, always incremented. Thus, a
tid reuse can only happen after wrapping around.

Again, while I fully agree that synchronization might be necessary, the
overall situation w.r.t. tid reusage is not be as bad as indicated.


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