Boost logo

Boost :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2001-12-20 10:41:29


--- In boost_at_y..., "rogeeff" <rogeeff_at_m...> wrote:
> Hi,
>
> After considering several possible solutions for implementing
> function timeout in WIN32 platform. it seems that there is no
> reliable solution based on async. canselation. Here what I propose:
>
> 1. As usual we need Timer thread. It could be new thread started
> every time we need to run test case with timeout. It could be
current
> thread while test case run in new one. It could be permanent thread
> responsible for timeouts.
> 2. Implementation will assume *synchronous* cancelation. This mean
> that when timeout occured Timer thread will set some 'timeout flag'
> which will be checked with every access to the framework. Now the
> user responcibility is to make sure that test case accessing
> framework frequently enough.
> 3. Timer thread will set internal timeout in, let say, 1 second
while
> it will wait for current test case to complete. If timeout will
> occured. we consider this as a fatal error and abort testing.
>
> What do you think?

I think that "cooperative cancellation" is pointless in a test case.
The only reason I can see (maybe I'm not seeing something in the
bigger picture though) for a timeout on a test case is to test for
infinite loop or deadlock bugs. Deadlock simply can't be tested with
cooperative cancellation and infinite loops, being bugs, are not
likely to be coded properly for cooperative cancellation either. In
other words, it's too difficult to write a test case that isn't buggy
itself.

Bill Kempf


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