Beispiel #1
0
OCI_Mutex * OCI_MutexCreateInternal
(
    void
)
{
    OCI_CALL_DECLARE_CONTEXT(TRUE)
        
    OCI_Mutex *mutex = NULL;

    /* allocate mutex structure */

    mutex = (OCI_Mutex *) OCI_MemAlloc(OCI_IPC_MUTEX, sizeof(*mutex), (size_t) 1, TRUE);
    OCI_STATUS = (NULL != mutex);

    if (OCI_STATUS)
    {
        /* allocate error handle */

        OCI_STATUS = OCI_HandleAlloc(OCILib.env, (dvoid **)(void *)&mutex->err, OCI_HTYPE_ERROR);

        /* allocate mutex handle */

        OCI_EXEC(OCIThreadMutexInit(OCILib.env, mutex->err, &mutex->handle))
    }

    if (!OCI_STATUS && mutex)
    {
        OCI_MutexFree(mutex);
        mutex = NULL;
    }

    return mutex;
}
Beispiel #2
0
OCI_Mutex * OCI_MutexCreateInternal
(
    void
)
{
    OCI_Mutex *mutex = NULL;
    boolean    res   = FALSE;

    /* allocate mutex structure */

    mutex = (OCI_Mutex *) OCI_MemAlloc(OCI_IPC_MUTEX, sizeof(*mutex), (size_t) 1, TRUE);

    if (mutex)
    {
        /* allocate error handle */

        res = OCI_SUCCESSFUL(OCI_HandleAlloc(OCILib.env, (dvoid **) (void *) &mutex->err,
                                             OCI_HTYPE_ERROR, (size_t) 0, (dvoid **) NULL));

        /* allocate mutex handle */

        OCI_CALL3
        (
            res, mutex->err,

            OCIThreadMutexInit(OCILib.env, mutex->err, &mutex->handle)
        )
    }

    if (!res && mutex)
    {
        OCI_MutexFree(mutex);
        mutex = NULL;
    }

    return mutex;
}