MapleCheckInterrupt - abort a computation when a user-interrupt is detected
|
Calling Sequence
|
|
MapleCheckInterrupt(kv)
|
|
Parameters
|
|
kv
|
-
|
kernel handle of type MKernelVector
|
|
|
|
|
Description
|
|
•
|
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.
|
|
|
Examples
|
|
#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.
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
|
|
Download Help Document
Was this information helpful?