GEOS  3.4.2
Interrupt.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2012 Sandro Santilli <strk@keybit.net>
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  **********************************************************************/
00014 
00015 #ifndef GEOS_UTIL_INTERRUPT_H
00016 #define GEOS_UTIL_INTERRUPT_H
00017 
00018 #include <geos/export.h>
00019 
00020 namespace geos {
00021 namespace util { // geos::util
00022 
00023 #define GEOS_CHECK_FOR_INTERRUPTS() geos::util::Interrupt::process()
00024 
00026 class GEOS_DLL Interrupt {
00027 
00028 public:
00029 
00030   typedef void (Callback)(void);
00031 
00038   static void request();
00039 
00041   static void cancel();
00042 
00044   static bool check();
00045 
00056   static Callback* registerCallback(Callback *cb);
00057 
00062   static void process();
00063 
00064   /* Perform the actual interruption (simply throw an exception) */
00065   static void interrupt();
00066 
00067 };
00068 
00069 
00070 } // namespace geos::util
00071 } // namespace geos
00072 
00073 
00074 #endif // GEOS_UTIL_INTERRUPT_H