Logo Search packages:      
Sourcecode: icu version File versions

U_STABLE void U_EXPORT2 u_setMutexFunctions ( const void *  context,
UMtxInitFn init,
UMtxFn destroy,
UMtxFn lock,
UMtxFn unlock,
UErrorCode status 

Set the functions that ICU will use for mutex operations Use of this function is optional; by default (without this function), ICU will directly access system functions for mutex operations This function can only be used when ICU is in an initial, unused state, before u_init() has been called. This function may be used even when ICU has been built without multi-threaded support (see ICU_USE_THREADS pre-processor variable, umutex.h)

contextThis pointer value will be saved, and then (later) passed as a parameter to the user-supplied mutex functions each time they are called.
initPointer to a mutex initialization function. Must be non-null.
destroyPointer to the mutex destroy function. Must be non-null.
lockpointer to the mutex lock function. Must be non-null.
unlockPointer to the mutex unlock function. Must be non-null.
statusReceives error values. ICU 2.8

Definition at line 405 of file umutex.c.


    if (U_FAILURE(*status)) {

    /* Can not set a mutex function to a NULL value  */
    if (i==NULL || d==NULL || l==NULL || u==NULL) {
        *status = U_ILLEGAL_ARGUMENT_ERROR;

    /* If ICU is not in an initial state, disallow this operation. */
    if (cmemory_inUse()) {
        *status = U_INVALID_STATE_ERROR;
    /* Kill any existing global mutex.  POSIX platforms have a global mutex
     * even before any other part of ICU is initialized.

    /* Swap in the mutex function pointers.  */
    pMutexInitFn    = i;
    pMutexDestroyFn = d;
    pMutexLockFn    = l;
    pMutexUnlockFn  = u;
    gMutexContext   = context;

#if defined (POSIX) 
    /* POSIX platforms must have a pre-initialized global mutex 
     * to allow other mutexes to initialize safely. */

Generated by  Doxygen 1.6.0   Back to index