sem_wait() is a cancellation point in libkse?
Craig Rodrigues
rodrigc at crodrigues.org
Mon Jan 19 21:39:49 PST 2004
Hi,
I am trying to learn about pthread cancellation points,
and am reading "Multithreaded Programming with PThreads" by
Bil Lewis. In chapter 10 of this book, it states
that sem_wait() should be implemented as a pthread
cancellation point.
I am not sure that sem_wait() is implemented as
a cancellation point in libkse.
I looked again at some of the Linux NPTL tests
which I ported to FreeBSD:
http://crodrigues.org/freebsd/nptl-tests.tar.gz
The tst-cancel12 test seems to be failing.
In this test, a thread is spawned with
pthread_create(), and then soon after
pthread_create(), pthread_cancel() is called
on this thread.
Inside the thread, sem_wait() is called.
The test is expecting that the thread should
immediately exit at the sem_wait() call because
sem_wait() should be a cancellation point.
However, the thread does not exist after calling
sem_wait(), so the test fails.
I see that in libkse's thr_sem.c, that there
is a _sem_wait() which looks like it is doing
cancellation stuff, but it doesn't
seem to be working.
Am I misunderstanding how this should work?
BTW, I could not compile tst_cancel12 against
libthr, because tst_cancel12 makes use
of pthread barriers, which don't seem
to be implemented in libthr.
Thanks for any clarification.
--
Craig Rodrigues
http://crodrigues.org
rodrigc at crodrigues.org
More information about the freebsd-threads
mailing list