bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glibc-linuxthread - Strange behaviour


From: Marco Aurélio Graciotto Silva
Subject: glibc-linuxthread - Strange behaviour
Date: Sat, 23 Nov 2002 18:53:41 -0200
User-agent: KMail/1.4.3

Hello

Since last month I have been playing with pthread at Linux and using the 
glibc-linuxthread (glibc-2.2.4). Last week I found a problem and till now I 
could't find anything that would cause it. Then I created a smaller test 
program just to try to reproduce the problem and, actually, I suceeded in 
that. I'll give a brief description of what the test program does. Attached 
I'm sending the source code.

It's a small program, a test one. It initializes a mutex and conditional 
variable, pthread_create() two new threads, each new thread calling 
goThread(), that suspends at pthread_cond_wait(). Back to the main thread, 
it calls pthread_cancel() on the two threads it has created and, after 
that, try joining them. Here is the problem, just the first one is joined, 
the second join call holds forever.

The test program's ideia is that, as pthread_cond_wait() is a cancellation 
point and I sent a pthread_cancel(), the threads will exit. And, in fact, 
one of then does exactly that. But why the second one doesn't? Someone can 
imagine why that's happening?



-- 
Marco Aurélio Graciotto Silva
Software Engineering Laboratory - LABES
Department of Computer Science and Statistics
USP - University of São Paulo
São Carlos, SP, Brazil

Attachment: cond_wait_test.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]