Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/fibril_synch.h

    ra35b458 ra55d76b1  
    143143} fibril_timer_t;
    144144
     145/** A counting semaphore for fibrils. */
     146typedef struct {
     147        long count;
     148        list_t waiters;
     149} fibril_semaphore_t;
     150
     151#define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
     152        { \
     153                .count = (cnt), \
     154                .waiters = { \
     155                        .head = { \
     156                                .next = &(name).waiters.head, \
     157                                .prev = &(name).waiters.head, \
     158                        } \
     159                } \
     160        }
     161
     162#define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
     163        fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
     164
    145165extern void fibril_mutex_initialize(fibril_mutex_t *);
    146166extern void fibril_mutex_lock(fibril_mutex_t *);
     
    174194extern fibril_timer_state_t fibril_timer_clear_locked(fibril_timer_t *);
    175195
     196extern void fibril_semaphore_initialize(fibril_semaphore_t *, long);
     197extern void fibril_semaphore_up(fibril_semaphore_t *);
     198extern void fibril_semaphore_down(fibril_semaphore_t *);
     199
    176200#endif
    177201
Note: See TracChangeset for help on using the changeset viewer.