00001 #ifndef _ddekit_semaphore_h 00002 #define _ddekit_semaphore_h 00003 00004 /** \defgroup DDEKit_synchronization */ 00005 00006 struct ddekit_sem; 00007 typedef struct ddekit_sem ddekit_sem_t; 00008 00009 /** Initialize DDEKit semaphore. 00010 * 00011 * \ingroup DDEKit_synchronization 00012 * 00013 * \param value initial semaphore counter 00014 */ 00015 ddekit_sem_t *ddekit_sem_init(int value); 00016 00017 /** Uninitialize semaphore. 00018 * 00019 * \ingroup DDEKit_synchronization 00020 */ 00021 void ddekit_sem_deinit(ddekit_sem_t *sem); 00022 00023 /** Semaphore down method. */ 00024 void ddekit_sem_down(ddekit_sem_t *sem); 00025 00026 /** Semaphore down method, non-blocking. 00027 * 00028 * \ingroup DDEKit_synchronization 00029 * 00030 * \return 0 success 00031 * \return !=0 would block 00032 */ 00033 int ddekit_sem_down_try(ddekit_sem_t *sem); 00034 00035 /** Semaphore down with timeout. 00036 * 00037 * \ingroup DDEKit_synchronization 00038 * 00039 * \return 0 success 00040 * \return !=0 would block 00041 */ 00042 int ddekit_sem_down_timed(ddekit_sem_t *sem, int timo); 00043 00044 /** Semaphore up method. 00045 * 00046 * \ingroup DDEKit_synchronization 00047 */ 00048 void ddekit_sem_up(ddekit_sem_t *sem); 00049 00050 #endif
1.5.6