This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add finit_module syscall for Linux
On Fri, Jan 25, 2013 at 04:57:05PM -0500, KOSAKI Motohiro wrote:
> >> (*) pthread_kill() must return -ESRCH if target thread was already
> >> exited. that imply
> >> pthread_self() returns pid like id number, not bare C pointer.
> >
> > false. that's only required if the impl *detects* the condition, and
> > even then only in outdated posix 2001. posix 2008 clarified the issue.
> > using kernel tids for pthread_t is a very bad design.
>
> I have no idea how to return -ESRCH if using pointer. Do you have?
there's no requirement to do so; in fact, doing so is harmful because
the code may seem to work (kill failing) but then signal the wrong
thread if the same tid got reassigned to a new thread. any use of a
pthtead_t after its lifetime is a serious programming error that is
fundamentally undetectable, just like using a pointer to malloc'd
memory after it was freed or using a pid aftef it was waited on.
Rich