Interrupt.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2012 Sandro Santilli <strk@kbt.io>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
namespace geos {
namespace util { // geos::util
class GEOS_DLL Interrupt {
public:
typedef void (Callback)(void);
static void request();
static void cancel();
static bool check();
static Callback* registerCallback(Callback* cb);
static void process();
/* Perform the actual interruption (simply throw an exception) */
static void interrupt();
};
class GEOS_DLL CurrentThreadInterrupt {
public:
typedef int (ThreadCallback)(void*);
static ThreadCallback* registerCallback(ThreadCallback* cb, void* data);
static void process();
static void interrupt();
};
} // namespace geos::util
} // namespace geos
inline void GEOS_CHECK_FOR_INTERRUPTS() { geos::util::Interrupt::process(); geos::util::CurrentThreadInterrupt::process(); }
geos::util::Interrupt
Used to manage interruption requests and callbacks.
Definition Interrupt.h:23
geos::util::Interrupt::check
static bool check()
geos::util::Interrupt::cancel
static void cancel()
geos::util::Interrupt::process
static void process()
geos::util::Interrupt::request
static void request()
geos::util::Interrupt::registerCallback
static Callback * registerCallback(Callback *cb)
Register a callback that will be invoked by all threads before checking for interruption requests.
geos::util
Utility classes for GEOS.
Definition namespaces.h:314
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38