Changeset a770666670c0036387c484fd9dc90622817cb34b
- Timestamp:
- 08/14/08 20:30:42 (5 years ago)
- git-parent:
- Files:
-
- src/utils/noit_sem.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/utils/noit_sem.h
rcd619cc ra770666 34 34 #define _UTILS_NOIT_SEM_H 35 35 36 /*! \fn int noit_sem_init(noit_sem_t *s, int unused, int value) 37 \brief initializes a counting semaphore for first time use. 38 \param s the semaphore to be initialized 39 \param unused is unused (keeps API combatibility with sem_init() 40 \param value sets the initial value of the semaphore 41 \return 0 on success or -1 on failure 42 */ 43 /*! \fn int noit_sem_wait(noit_sem_t *s) 44 \brief decrements the value of the semaphore waiting if required. 45 \param s the semaphore on which to wait 46 \return 0 on success or -1 on failure 47 */ 48 /*! \fn int noit_sem_post(noit_sem_t *s) 49 \brief increments the value of the semaphore releasing any waiters. 50 \param s the semaphore on which to wait 51 \return 0 on success or -1 on failure 52 */ 53 /*! \fn int noit_sem_trywait(noit_sem_t *s) 54 \brief decrements the value of the semaphore if greater than 0 or fails 55 \param s the semaphore on which to wait 56 \return 0 on success or -1 on failure 57 */ 58 /*! \fn int noit_sem_getvalue(noit_sem_t *s, int *value) 59 \brief retrieves the current value of a semaphore, placing it in *value 60 \param s the semaphore on which to operate 61 \param value a pointer an integer that will be populated with the current value of the semaphore 62 \return 0 on success or -1 on failure 63 */ 64 /*! \fn int noit_sem_destroy(noit_sem_t *s) 65 \brief releases all resources related to a semaphore 66 \param s the semaphore to destroy 67 \return 0 on success or -1 on failure 68 */ 36 69 #ifdef BROKEN_SEM_INIT 37 70 … … 44 77 } noit_sem_t; 45 78 46 /*! \fn int noit_sem_init(noit_sem_t *s, int unused, int value)47 \brief initializes a counting semaphore for first time use.48 \param s the semaphore to be initialized49 \param unused is unused (keeps API combatibility with sem_init()50 \param value sets the initial value of the semaphore51 \return 0 on success or -1 on failure52 */53 79 API_EXPORT(int) noit_sem_init(noit_sem_t *, int, int); 54 /*! \fn int noit_sem_wait(noit_sem_t *s)55 \brief decrements the value of the semaphore waiting if required.56 \param s the semaphore on which to wait57 \return 0 on success or -1 on failure58 */59 80 API_EXPORT(int) noit_sem_wait(noit_sem_t *); 60 /*! \fn int noit_sem_post(noit_sem_t *s)61 \brief increments the value of the semaphore releasing any waiters.62 \param s the semaphore on which to wait63 \return 0 on success or -1 on failure64 */65 81 API_EXPORT(void) noit_sem_post(noit_sem_t *); 66 /*! \fn int noit_sem_trywait(noit_sem_t *s)67 \brief decrements the value of the semaphore if greater than 0 or fails68 \param s the semaphore on which to wait69 \return 0 on success or -1 on failure70 */71 82 API_EXPORT(int) noit_sem_trywait(noit_sem_t *); 72 /*! \fn int noit_sem_getvalue(noit_sem_t *s, int *value)73 \brief retrieves the current value of a semaphore, placing it in *value74 \param s the semaphore on which to operate75 \param value a pointer an integer that will be populated with the current value of the semaphore76 \return 0 on success or -1 on failure77 */78 83 API_EXPORT(int) noit_sem_getvalue(noit_sem_t *, int *); 79 /*! \fn int noit_sem_destroy(noit_sem_t *s)80 \brief releases all resources related to a semaphore81 \param s the semaphore to destroy82 \return 0 on success or -1 on failure83 */84 84 API_EXPORT(void) noit_sem_destroy(noit_sem_t *); 85 85
