Home | History | Annotate | Download | only in src

Lines Matching refs:semaphore

19  * @brief        Semaphore for Windows
20 * @note This file implements functions to manipulate semaphore
32 #include <semaphore.h>
40 /* Context for the semaphore */
42 M4OSA_UInt32 coreID; /* semaphore context identifiant */
43 sem_t semaphore; /* semaphore */
51 * @brief This method creates a new semaphore with the "initialCounter"
56 * parameter will be sent back to any OSAL core semaphore functions
57 * to allow retrieving data associated to the opened semaphore.
58 * @param context:(OUT) Context of the created semaphore
59 * @param initial_count:(IN) Initial counter of the semaphore
81 (M4OSA_Char*)"M4OSA_semaphoreOpen: semaphore context");
90 if (0 != sem_init(&semaphoreContext->semaphore, 0, initial_count))
95 "M4OSA_semaphoreOpen: OS semaphore creation failed");
111 * @brief This method decrements (one by one) the semaphore counter. The
112 * semaphore is identified by its context This call is not blocking
113 * if the semaphore counter is positive or zero (after
114 * decrementation). This call is blocking if the semaphore counter
115 * is less than zero (after decrementation), until the semaphore is
119 * will block indefinitely until the semaphore is unlocked.
120 * @param context:(IN/OUT) Context of the semaphore
124 * @return M4WAR_TIME_OUT: time out is elapsed before semaphore has been
147 if ( 0 != sem_wait(&semaphoreContext->semaphore) )
150 "M4OSA_semaphoreWait: OS semaphore wait failed");
157 result = sem_trywait(&semaphoreContext->semaphore);
172 result = sem_trywait(&semaphoreContext->semaphore);
182 M4OSA_DEBUG(M4ERR_BAD_CONTEXT, "M4OSA_semaphoreWait: OS semaphore wait failed");
197 * @brief This method increments the semaphore counter. The semaphore is
199 * @note If the semaphore counter is upper than zero (after addition),
204 * @param context:(IN/OUT) Context of the semaphore
222 sem_post(&semaphoreContext->semaphore);
233 * @brief This method deletes a semaphore (identify by its context).
234 * After this call the semaphore and its context is no more
236 * semaphore.
238 * on the deleted semaphore.
239 * @param context:(IN/OUT) Context of the semaphore
257 sem_destroy(&semaphoreContext->semaphore);