Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2131 | Rev 2307 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | typedef struct { |
42 | typedef struct { |
43 | semaphore_t sem; |
43 | semaphore_t sem; |
44 | } mutex_t; |
44 | } mutex_t; |
45 | 45 | ||
46 | #define mutex_lock(mtx) \ |
46 | #define mutex_lock(mtx) \ |
47 | _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
47 | _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) |
48 | #define mutex_trylock(mtx) \ |
48 | #define mutex_trylock(mtx) \ |
49 | _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
49 | _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) |
50 | #define mutex_lock_timeout(mtx,usec) \ |
50 | #define mutex_lock_timeout(mtx, usec) \ |
51 | _mutex_lock_timeout((mtx),(usec),SYNCH_FLAGS_NON_BLOCKING) |
51 | _mutex_lock_timeout((mtx), (usec), SYNCH_FLAGS_NON_BLOCKING) |
52 | #define mutex_lock_active(mtx) \ |
- | |
53 | while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC) |
- | |
54 | 52 | ||
55 | extern void mutex_initialize(mutex_t *mtx); |
53 | extern void mutex_initialize(mutex_t *mtx); |
56 | extern int _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, int flags); |
54 | extern int _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, int flags); |
57 | extern void mutex_unlock(mutex_t *mtx); |
55 | extern void mutex_unlock(mutex_t *mtx); |
58 | 56 |