MapleMutexLock - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


MapleMutexLock

lock a mutex

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

MapleMutexLock( kv, mutex );

Parameters

kv

-

kernel handle of type MKernelVector

mutex

-

a mutex identifier (ALGEB)

Description

• 

MapleMutexLock locks a mutex.  Only one thread can have a mutex locked at any one time.  If another thread is holding the lock, the current thread will block until it can obtain the lock.

• 

To release the lock on a mutex, use the MapleMutexUnlock function.

• 

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

• 

The mutex identifier used by MapleMutexLock 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.

Examples

#include "maplec.h"

 

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

{

    ALGEB ret;

 

    MapleMutexLock( kv, mutex );

    ret = CriticalSection( kv, args );

    MapleMutexUnlock( kv, mutex );

 

    return ret;

}

See Also

CustomWrapper

define_external

MapleMutexCreate

MapleMutexDestroy

MapleMutexUnlock

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples

OpenMaple/C/MutexDestroy

OpenMaple/C/MutexLock

OpenMaple/C/MutexUnlock

Threads[Mutex]