lkml.org 
[lkml]   [2008]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Possible 2.6.24-rc7 issue w/respect to pthreads
tom@kavaga.com wrote:
> To Whom It May Concern,
>
> After I patched my 2.6.23 kernel to 2.6.24-rc7 this morning, I noticed
> some odd behavior with respect to POSIX threads in a test program I had
> written (originally to test epoll.)
>
> The behavior is as follows:
>
> 1. main() creates a new thread of execution with pthread_create
> 2. thread_func() immediately calls pthread_detach(), which is supposed to
> ensure that thread resources are cleaned up when the thread terminates.
> 3. The spawned thread sleeps and then prints a message "got here"
> 4. The main thread calls pthread_join(). According to the POSIX
> documentation, this should suspend execution until the spawned thread has
> terminated.

Quoting the man page of pthread_detach():

After pthread_detach completes, subsequent attempts to perform
pthread_join on th will fail.

regard - Marc
--
Marc Kleine-Budde Phone: +49-231-2826-924
Pengutronix - Linux Solutions for Science and Industry
Vertretung West/Dortmund http://www.pengutronix.de

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-01-09 11:55    [W:0.035 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site