Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jan 2004 00:39:45 -0500
From:      Craig Rodrigues <rodrigc@crodrigues.org>
To:        freebsd-threads@freebsd.org
Subject:   sem_wait() is a cancellation point in libkse?
Message-ID:  <20040120053945.GA4096@crodrigues.org>

next in thread | raw e-mail | index | archive | help
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@crodrigues.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040120053945.GA4096>