Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/semaphore.h

    re88eb48 r597fa24  
    4545} semaphore_t;
    4646
    47 #define semaphore_down(s) \
    48         _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
     47#define SEMAPHORE_INITIALIZER(name, count) (semaphore_t) { \
     48        .wq = WAITQ_INITIALIZER_WITH_COUNT((name).wq, count), \
     49}
    4950
    50 #define semaphore_trydown(s) \
    51         _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING)
    52 
    53 #define semaphore_down_timeout(s, usec) \
    54         _semaphore_down_timeout((s), (usec), SYNCH_FLAGS_NONE)
    55 
    56 #define semaphore_down_interruptable(s) \
    57         (_semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, \
    58                 SYNCH_FLAGS_INTERRUPTIBLE) != EINTR)
     51#define SEMAPHORE_INITIALIZE(name, count) \
     52        semaphore_t name = SEMAPHORE_INITIALIZER(name, count)
    5953
    6054extern void semaphore_initialize(semaphore_t *, int);
    61 extern errno_t _semaphore_down_timeout(semaphore_t *, uint32_t, unsigned int);
     55extern errno_t semaphore_down_timeout(semaphore_t *, uint32_t);
     56extern errno_t semaphore_trydown(semaphore_t *);
     57extern void semaphore_down(semaphore_t *);
    6258extern void semaphore_up(semaphore_t *);
    63 extern int semaphore_count_get(semaphore_t *);
    6459
    6560#endif
Note: See TracChangeset for help on using the changeset viewer.