GEOS  3.13.0dev
Interrupt.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2012 Sandro Santilli <strk@kbt.io>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 #pragma once
16 
17 #include <geos/export.h>
18 
19 namespace geos {
20 namespace util { // geos::util
21 
22 #define GEOS_CHECK_FOR_INTERRUPTS() geos::util::Interrupt::process()
23 
25 class GEOS_DLL Interrupt {
26 
27 public:
28 
29  typedef void (Callback)(void);
30 
37  static void request();
38 
40  static void cancel();
41 
43  static bool check();
44 
55  static Callback* registerCallback(Callback* cb);
56 
61  static void process();
62 
63  /* Perform the actual interruption (simply throw an exception) */
64  static void interrupt();
65 
66 };
67 
68 
69 } // namespace geos::util
70 } // namespace geos
71 
Used to manage interruption requests and callbacks.
Definition: Interrupt.h:25
static Callback * registerCallback(Callback *cb)
Register a callback that will be invoked before checking for interruption requests.
static bool check()
static void cancel()
static void process()
static void request()
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25