|
a/src/utils/cancelcheck.h |
|
b/src/utils/cancelcheck.h |
|
... |
|
... |
14 |
* Free Software Foundation, Inc.,
|
14 |
* Free Software Foundation, Inc.,
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#ifndef _CANCELCHECK_H_INCLUDED_
|
17 |
#ifndef _CANCELCHECK_H_INCLUDED_
|
18 |
#define _CANCELCHECK_H_INCLUDED_
|
18 |
#define _CANCELCHECK_H_INCLUDED_
|
19 |
/* @(#$Id: cancelcheck.h,v 1.4 2008-11-18 13:24:43 dockes Exp $ (C) 2005 J.F.Dockes */
|
19 |
/* @(#$Id: cancelcheck.h,v 1.5 2008-11-18 13:51:09 dockes Exp $ (C) 2005 J.F.Dockes */
|
20 |
|
20 |
|
21 |
|
21 |
|
22 |
/**
|
22 |
/**
|
23 |
* Common cancel checking mechanism
|
23 |
* Common cancel checking mechanism
|
24 |
*
|
24 |
*
|
|
... |
|
... |
28 |
* interactive (or otherwise controlling) task and a long-working one:
|
28 |
* interactive (or otherwise controlling) task and a long-working one:
|
29 |
* - The control task calls setCancel(), usually as a result of user
|
29 |
* - The control task calls setCancel(), usually as a result of user
|
30 |
* interaction, if the worker takes too long.
|
30 |
* interaction, if the worker takes too long.
|
31 |
* - The worker task calls checkCancel() at regular intervals, possibly as
|
31 |
* - The worker task calls checkCancel() at regular intervals, possibly as
|
32 |
* a side-effect of some other progress-reporting call. If cancellation has
|
32 |
* a side-effect of some other progress-reporting call. If cancellation has
|
33 |
* been requested, this will raise an exception.
|
33 |
* been requested, this will raise an exception, to be catched and processed
|
34 |
* The worker routine must be exception-clean, and the caller should
|
34 |
* wherever the worker was invoked.
|
35 |
* catch the CancelExcept exception.
|
35 |
* Of course, the worker side must be exception-clean, but this otherwise avoids
|
36 |
*
|
36 |
* having to set-up code to handle a special cancellation error along
|
|
|
37 |
* the whole worker call stack.
|
37 |
*/
|
38 |
*/
|
38 |
class CancelExcept {};
|
39 |
class CancelExcept {};
|
39 |
|
40 |
|
40 |
class CancelCheck {
|
41 |
class CancelCheck {
|
41 |
public:
|
42 |
public:
|