diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2019-08-14 11:45:34 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2019-08-14 11:45:34 +0200 |
commit | d9261bdb05cd0863a2c3747c812871dbb851646e (patch) | |
tree | d1a81110e3fe213747a58f236e021a085417f663 /include/astra/Globals.h | |
parent | 9a58b7451179ed512f975bc4c90fb71f172250b9 (diff) | |
download | astra-d9261bdb05cd0863a2c3747c812871dbb851646e.tar.gz astra-d9261bdb05cd0863a2c3747c812871dbb851646e.tar.bz2 astra-d9261bdb05cd0863a2c3747c812871dbb851646e.tar.xz astra-d9261bdb05cd0863a2c3747c812871dbb851646e.zip |
Replace signal-based abort handling by query-based handling
The abort handling is currently only used to process Ctrl-C from Matlab.
Since Matlab R2019a, it appears that calling utIsInterruptPending() from
a thread other than the main thread will crash. The previous approach of
checking utIsInterruptPending() in a thread, and then signalling the running
algorithm was therefore broken.
Diffstat (limited to 'include/astra/Globals.h')
-rw-r--r-- | include/astra/Globals.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/astra/Globals.h b/include/astra/Globals.h index 993e443..a353940 100644 --- a/include/astra/Globals.h +++ b/include/astra/Globals.h @@ -150,6 +150,25 @@ namespace astra { }; } +//---------------------------------------------------------------------------------------- +// functions for internal use + +namespace astra { + +/** Specify a function) to be called by shouldAbort() to check if an external + * abort signal has arrived, or NULL to disable. Intended to be used by the + * matlab/python interfaces to check if Ctrl-C has been pressed. + */ +void setShouldAbortHook(bool (*pShouldAbortHook)(void)); + +/** Check if we should abort execution (due to an external signal). + */ +bool shouldAbort(); +} + +//---------------------------------------------------------------------------------------- +// functions for external use + namespace astra { _AstraExport inline int getVersion() { return ASTRA_TOOLBOXVERSION; } _AstraExport inline const char* getVersionString() { return ASTRA_TOOLBOXVERSION_STRING; } |