•
|
The MapleRegisterThread and MapleUnregisterThread functions allow user created threads to register and unregister themselves with Maple so that those threads can have access to Maple's functionality.
|
A user created thread is a thread that was not created by Maple (via Threads:-Create or as part of the Task Programming Model). For example, threads created when a user calls pthread_create or a similar function.
•
|
The only Maple external call function usable by an unregistered thread is MapleGetInterruptValue. No other functions are supported.
|
•
|
By calling MapleRegisterThread, Maple creates thread local data structures required to execute various Maple features. Which structures are created are specified by the options field.
|
Currently only the MAPLE_ENABLE_GMP option is supported. This creates the structure necessary to allow MaplePushGMPAllocators and MaplePopGMPAllocators to function properly in the current thread.
•
|
The MapleUnregisterThread function removes the data structures when the thread is finished using Maple features.
|
•
|
On success, MapleRegisterThread and MapleUnregisterThread returns MAPLE_SUCCEEDED. On failure one of the following error codes are returned:
|
MAPLE_ERROR_INVALID_OPTIONS: the given options is not valid.
MAPLE_ERROR_ALREADY_REGISTERED: the thread has already been registered or it is a thread created by Maple.
MAPLE_ERROR_NOT_REGISTERED: a call to unregister is made on a thread that has not been registered.