Lines Matching refs:mutex

19  * @note         This file implements functions to manipulate mutex
33 /* Context for the mutex */
36 M4OSA_UInt32 coreID; /* mutex context identifiant */
37 pthread_mutex_t mutex; /* mutex */
45 * @brief This method creates a new mutex.
49 * will be sent back to any OSAL core mutex functions to allow
50 * retrieving data associated to the opened mutex.
51 * @param pContext:(OUT) Context of the created mutex
70 M4OSA_MUTEX, (M4OSA_Char*)"M4OSA_mutexOpen: mutex context");
78 /* Initialize the mutex attribute. */
81 /* Initialize the mutex type. */
84 /* Initialize the mutex. */
85 if (0 == pthread_mutex_init( &pMutexContext->mutex, &attribute ) )
91 /* Destroy the mutex attribute. */
97 M4OSA_DEBUG(M4ERR_CONTEXT_FAILED, "M4OSA_mutexOpen: OS mutex creation failed");
116 * @brief This method locks the mutex. "Context" identifies the mutex.
117 * @note If the mutex is already locked, the calling thread blocks until
118 * the mutex becomes available (by calling M4OSA_mutexUnlock) or
120 * @param context:(IN/OUT) Context of the mutex
124 * @return M4WAR_TIME_OUT: time out is elapsed before mutex has been
149 M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexLock: Thread tried to lock a mutex it already owns");
153 /* Lock the mutex. */
156 if ( 0 != pthread_mutex_lock(&pMutexContext->mutex) )
158 M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexLock: OS mutex wait failed");
164 result = pthread_mutex_trylock(&pMutexContext->mutex);
179 result = pthread_mutex_trylock(&pMutexContext->mutex);
189 M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexLock: OS mutex wait failed");
204 * @brief This method unlocks the mutex. The mutex is identified by
210 * @param context:(IN/OUT) Context of the mutex
231 M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_mutexUnlock: Thread tried to unlock a mutex it doesn't own");
237 pthread_mutex_unlock(&pMutexContext->mutex);
247 * @brief This method deletes a mutex (identify by its context). After
248 * this call, the mutex and its context is no more useable. This
249 * function frees all the memory related to this mutex.
251 * on the deleted mutex.
252 * @param context:(IN/OUT) Context of the mutex
269 pthread_mutex_destroy(&pMutexContext->mutex);