Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-09-03 03:13:30


In message <20000903033926.37781_at_[hidden]>, Valentin Bonnard
<Bonnard.V_at_[hidden]> writes
>> I assure you, it is not.
>
>So explain me why. I really don't see the difference.

OS 101? ;-)

Although they are both execute wrt context switches and are asynchronous
(assuming pre-emptive thread scheduling), that's where the similarities
end.

To take a simple example, what can you legally do w/i a signal handler?
IIRC, you are limited to calling signal, longjmp, abort, exit, and
assigning to a volatile sig_atomic_t, and that's it in the C standard.
The POSIX standard is a little more generous, but in POSIX threading the
constraints are more liberal still. These are practical points, but
serve to reinforce the fact that they are fundamentally different
mechanisms -- if they were similar, why would they interact so badly?

>What Greg posted is the dual of guaranty: if you don't do that
>they are no guaranties. Does it count as a guaranty (if you do
>that, there are guaranties) ? Or is a signal handler expected
>to behave like any other C++ function, except for specific
>exceptions (types other than volatile sig_atomic_t, etc.) ?

As outlined above, you have few guarantees. As Greg said, assume the
worst.
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  Curbralan Ltd mobile: +44 7801 073 508
  kevlin_at_[hidden] fax: +44 870 052 2289
____________________________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk