Re: Has pthreads become antiquated?
- From: Joe Seigh <jseigh_01@xxxxxxxxxx>
- Date: Sun, 28 May 2006 08:22:40 -0400
Maxim Yegorushkin wrote:
Joe Seigh wrote:
I'm trying yet again to design an async safe function
because unix has signals which are still being designed
into new api's. There's only one async safe pthread
function and that's sem_post which is probably not the
most useful synchronization function around. Plus it's
not implemented in OSX. Well, it is but only to tell
you by return code that it's not implemented. While
that's not entirely stupid, it is very high up my List
of Stupid.
So I'll probably have to go with platform specific
solutions like futex on Linux and I don't know what
yet on OSX.
What is wrong with the idiomatic solution when you do nothing but write
a byte to a pipe/socketpair in the signal handler?
It's very limited. You can't really share data between signal handlers
and threads. And you're limited with what you can do with sig_atomic_t
and the thread that the signal handler runs on (sig_atomic_t having no
meaning w.r.t. the other threads). And if you restrict signals to
specific threads so you can use sig_atomic_t, you lose some of the advantages
of being able to dispatch a signal on any thread enabled for those signals.
Since unix signals aren't going away and more people will start to realize
that synchronizing data with signal handlers is problematic and that posix
offers no solutions, solutions will be developed outside of posix increasing
the marginalization of posix.
Though to be fair to posix threads, if condition variables were like signals,
condvars would be predefined and there would only be two of them for use by
an application.
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software. .
- Follow-Ups:
- Re: Has pthreads become antiquated?
- From: Maxim Yegorushkin
- Re: Has pthreads become antiquated?
- References:
- Has pthreads become antiquated?
- From: Joe Seigh
- Re: Has pthreads become antiquated?
- From: Maxim Yegorushkin
- Has pthreads become antiquated?
- Prev by Date: Re: checking return value of pthread_mutex_lock ...
- Next by Date: Re: Has pthreads become antiquated?
- Previous by thread: Re: Has pthreads become antiquated?
- Next by thread: Re: Has pthreads become antiquated?
- Index(es):
Relevant Pages
|