MapleCheckInterrupt
abort a computation when a user-interrupt is detected
Calling Sequence
Parameters
Description
Examples
MapleCheckInterrupt(kv)
kv
-
kernel handle of type MKernelVector
This function can be used in external code with OpenMaple or define_external.
The MapleCheckInterrupt function examines the interrupt request queue and aborts an external computation by raising an untrappable Maple exception. The interrupt request queue is full when a user presses the Stop button or Ctrl-C. The effect is that external code is aborted in the same way as Maple code is aborted when Stop or Ctrl-C is pressed.
When no interrupt is pending, MapleCheckInterrupt returns immediately. Otherwise, MapleCheckInterrupt does not return. Therefore it is important to call this function only when it is safe to abort your current computation. It is safe to abort any time your memory is consistent. That is, if you were to call the same procedure again, it would not rely on incomplete, or partially formed data left over from the aborted call. This includes partially formed Maple objects that will not be fully scannable during the next Maple garbage collection.
#include "maplec.h"
ALGEB M_DECL TestInterrupt( MKernelVector kv, ALGEB *args )
{
int i;
for( i=0; i<5000000; ++i ) {
MapleCheckInterrupt(kv);
}
return( ToMapleBoolean(kv,FALSE) );
Execute the external function from Maple.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
p≔DefineExternal⁡TestInterrupt,dll:
p⁡
false
See Also
CustomWrapper
define_external
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
Download Help Document