[c++-pthreads] thread-safety definition
Richard Henderson
rth at redhat.com
Thu Jan 8 21:36:55 UTC 2004
On Thu, Jan 08, 2004 at 03:43:52PM +0100, Alexander Terekhov wrote:
> C++ aside for a moment, I have yet to see async-cancel-UNsafe
> implementation of, say, strlen(). Care to inspire me? TIA.
I have yet to see an async-safe exception runtime. It's certainly
possible, but it requires the addition of lots of memory barriers
to the code. Which no one adds because all C++ exceptions are
synchronous [1]. Even Java exceptions are synchronous; the times
that they begin propagation from signal handlers are all
synchronous signals like SIGSEGV or SIGFPE, and the compiler
knows which instructions might produce them.
Thus I believe you will find that async cancelation does *not*
actually invoke cleanup handlers in existing implementations.
r~
[1] Ada exceptions are async, but that language explicitly denys some
of the data availability guarantees that other languages make, which
allows you to avoid the memory barriers.
More information about the c++-pthreads
mailing list