unlock a mutex - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : OpenMaple : C Application Programming Interface : Parallel Programming : OpenMaple/C/MapleMutexUnlock

MapleMutexUnlock - unlock a mutex

Calling Sequence

MapleMutexUnlock( kv, mutex );




kernel handle of type MKernelVector



a mutex identifier (ALGEB)



MapleMutexUnlock unlocks a mutex.  This allows another thread to lock the mutex.  If other threads are attempting to obtain the lock, one will acquire the lock, and the others will continue waiting.


To obtain the lock on a mutex, use the MapleMutexLock function.


A mutex can be created in external call using the MapleMutexCreate function.


The mutex identifier used by MapleMutexUnlock is compatible with the functions in the Threads[Mutex] package.  Thus mutexes created by Threads[Mutex][Create] can be passed into external call, and used by MapleMutexLock and MapleMutexUnlock.


#include "maplec.h"


ALGEB M_DECL ParallelFunction( MKernelVector kv, ALGEB mutex, ALGEB args )


    ALGEB ret;


    MapleMutexUnlock( kv, mutex );

    ret = CriticalSection( kv, args );

    MapleMutexUnlock( kv, mutex );


    return ret;


See Also

CustomWrapper, define_external, MapleMutexCreate, MapleMutexDestroy, MapleMutexLock, OpenMaple, OpenMaple/C/API, OpenMaple/C/Examples, OpenMaple/C/MutexDestroy, OpenMaple/C/MutexLock, OpenMaple/C/MutexUnlock, Threads[Mutex]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam