This is the mail archive of the
mailing list for the pthreas-win32 project.
RE: Pthread-win32 races?
- From: "Ye Liu" <yliu at tibco dot com>
- To: "Sergey Fokin" <green dot nsk at gmail dot com>, <pthreads-win32 at sourceware dot org>
- Date: Tue, 12 Dec 2006 12:12:41 -0800
- Subject: RE: Pthread-win32 races?
Can I be removed from the mail list?
[mailto:email@example.com] On Behalf Of Sergey Fokin
Sent: Tuesday, December 12, 2006 4:27 AM
Subject: Pthread-win32 races?
I have some peculiarities with pthread-win32 and suppose there's a bug
Here's my example code:
void * thr(void * arg)
int error = 0;
error = sem_init(&sem, 0, 0); // OK
error = pthread_create(&thread, 0, thr, &sem); // OK
error = sem_destroy(&sem);
if (error != 0)
error = errno; // errno == 16 (EBUSY)
printf("errno = %d\n", error);
So, here we have error 16 (0x10) in almost all runs, independently on
compile options (at least i couldn't find working combination).
Compiler is msvc 7.1 sp1.
I've read about some troubles with it in BUGS file, but first, this one
is unrelated to those, as I can see, second all tests from `tests'
directory run with no errors, but this one fails even with same compile
When I've tried to debug, it turned out that when main() is executing
sem_destroy(), child thread is still in sem_post(). But I couldn't find
out what's going on there and supposed this is some kind of race, this
is why subject is about races.
Google didn't find similar issues about pthread-win32 library.
Really hope, this is my fault, but I have no idea where I'm wrong.
Thanks in advance.
PS I'll also try gcc for win32 and msvc8.0 later - I don't have them on