MapleCheckInterrupt - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MapleCheckInterrupt

abort a computation when a user-interrupt is detected

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

MapleCheckInterrupt(kv)

Parameters

kv

-

kernel handle of type MKernelVector

Description

• 

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.

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.

withExternalCalling&colon;

dllExternalLibraryNameHelpExamples&colon;

pDefineExternalTestInterrupt&comma;dll&colon;

p

false

(1)

See Also

CustomWrapper

define_external

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples