Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Aug 2005 10:28:55 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Poul-Henning Kamp <phk@haven.freebsd.dk>
Cc:        current@freebsd.org
Subject:   Re: pthreads: shouldn't nanosleep() be a cancellation point ? 
Message-ID:  <Pine.GSO.4.43.0508021021450.5408-100000@sea.ntplx.net>
In-Reply-To: <25679.1122992242@phk.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2 Aug 2005, Poul-Henning Kamp wrote:

> In message <Pine.GSO.4.43.0508021007350.5408-100000@sea.ntplx.net>, Daniel Eisc
> hen writes:
>
> >Hmm, the same could be said for sleep() in libc also, but we jump
> >through hoops to allow the thread libraries override sleep() with
> >their own cancellable version.  I think this is in case libc wants
> >to use sleep(), usleep(), nanosleep() internally and not introduce
> >cancellation points into functions that shouldn't have them.
>
> usleep() calls _nanosleep() but I wonder if it shouldn't be
> redirected into the thead libraraies like sleep/nanosleep ?

Yes, I think we should just add a cancellable version of usleep()
to libpthread/thread/thr_sleep.c.  syslog() is a consumer of
usleep(), but I think it really wants to use _usleep() or
_nanosleep().  By using usleep() it introduces a cancellation
point while holding a lock.

Do you want to do the mods to libpthread and libthr (in
libthr/thread/thr_syscalls.c) or do you want me to do them?

-- 
DE




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0508021021450.5408-100000>