Boost logo

Boost :

From: terekhov (terekhov_at_[hidden])
Date: 2001-12-12 11:13:58


--- In boost_at_y..., Beman Dawes <bdawes_at_a...> wrote:
> At 04:13 AM 12/12/2001, p_michel_andre wrote:
>
> >I was one of the guys proposing a solution to Beman for the Alarm
> >feature in NT. My solution doesn't use Terminate thread. Below is
a
> >short description:
> >
> >The alarm class creates an external thread to handle the timeout
and
> >if an timeout occurs the external thread suspends the original
thread
> >and perfoms a GetThreadContexts and sets the x86 Eip program
counter
> >to a function that raises an user defined software exception which
> >then can be caught via NT:s exception mechanism (and rethrown as
an
> >C++ exception to be caught). The interface was something like:
> >try
> >{
> > Alarm alarm(1000); // timeout in msecs
> > lenghty_call(); // call that takes more than 1000 msecs
> >}
> >catch(Alarm::Timeout&)
> >{
> > std::cout << "Timeout occured!";
> >}
> >
> >But that can of course be changed.
> >
> >
> >Actually I havent got the code. Maybe Beman still has it. Ive had
a
> >disk crash so i have to rewrite it or reload an backup.
>
> It has disappeared from my hard disk too. Let me check backups.
>
> Wow! That was fast. CD backups make it much easier to recover
single
> files than from the tape system I used to use.
>
> See attached.

[ ... see http://sources.redhat.com/cgi-
bin/cvsweb.cgi/pthreads/cancel.c?rev=1.21&content-type=text/x-cvsweb-
markup&cvsroot=pthreads-win32 ;-) ]

Do you mean that all the code you are going to "test" using
Alarm/Alarm::Timeout exception is supposed to be async.cancel
safe?!?! (i.e. it will not acquire any resources including
locking some mutex; e.g. some libc/c++ internal mutex, etc..
see Butenhof's PWPT book for details (dangers) with respect
to async.cancelation).

regards,
alexander.


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