Rev 2085 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2085 | Rev 2089 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #ifndef KERN_SEMAPHORE_H_ |
35 | #ifndef KERN_SEMAPHORE_H_ |
36 | #define KERN_SEMAPHORE_H_ |
36 | #define KERN_SEMAPHORE_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | #include <typedefs.h> |
- | |
40 | #include <synch/waitq.h> |
39 | #include <synch/waitq.h> |
41 | #include <synch/synch.h> |
40 | #include <synch/synch.h> |
42 | 41 | ||
43 | typedef struct { |
42 | typedef struct { |
44 | waitq_t wq; |
43 | waitq_t wq; |
45 | } semaphore_t; |
44 | } semaphore_t; |
46 | 45 | ||
47 | #define semaphore_down(s) \ |
46 | #define semaphore_down(s) \ |
48 | _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
47 | _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) |
49 | #define semaphore_trydown(s) \ |
48 | #define semaphore_trydown(s) \ |
50 | _semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
49 | _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) |
51 | #define semaphore_down_timeout(s,usec) \ |
50 | #define semaphore_down_timeout(s, usec) \ |
52 | _semaphore_down_timeout((s),(usec),SYNCH_FLAGS_NONE) |
51 | _semaphore_down_timeout((s), (usec), SYNCH_FLAGS_NONE) |
53 | 52 | ||
54 | extern void semaphore_initialize(semaphore_t *s, int val); |
53 | extern void semaphore_initialize(semaphore_t *s, int val); |
55 | extern int _semaphore_down_timeout(semaphore_t *s, uint32_t usec, int flags); |
54 | extern int _semaphore_down_timeout(semaphore_t *s, uint32_t usec, int flags); |
56 | extern void semaphore_up(semaphore_t *s); |
55 | extern void semaphore_up(semaphore_t *s); |
57 | 56 |