MapleMutexCreate - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

MapleMutexCreate

create a mutex

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

MapleMutexCreate( kv, options );

Parameters

kv

-

kernel handle of type MKernelVector

options

-

an expression sequence of options (ALGEB)

Description

• 

MapleMutexCreate creates a mutex that can be used to implement critical sections in external call code.  It returns an mutex identifier that is passed into MapleMutexLock and MapleMutexUnlock.

• 

There are currently no options supported by the MapleMutexCreate, thus a Maple null should be passed for the options argument.  A Maple null can be obtained by calling ToMapleNULL.

• 

The mutex identifier returned by MapleMutexCreate is compatible with the functions in the Threads[Mutex] package.  Thus mutexes created by MapleMutexCreate can be returned to Maple and used by Threads[Mutex][Lock] and Threads[Mutex][Unlock].

• 

When a mutex is no longer needed it should be released by passing it into MapleMutexDestroy.

Examples

#include "maplec.h"

 

ALGEB M_DECL Function( MKernelVector kv, ALGEB args )

{

    ALGEB mutex, ret;

 

    mutex = MapleMutexCreate( kv, ToMapleNULL(kv) );

    ret = DoParallelWork( kv, mutex, args );

    MapleMutexDestroy( kv, mutex );

 

    return ret;

}

See Also

CustomWrapper

define_external

MapleMutexDestroy

MapleMutexLock

MapleMutexUnlock

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