Rev 1380 | Rev 1702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1380 | Rev 1502 | ||
|---|---|---|---|
| Line 37... | Line 37... | ||
| 37 | struct mutex { |
37 | struct mutex { |
| 38 | semaphore_t sem; |
38 | semaphore_t sem; |
| 39 | }; |
39 | }; |
| 40 | 40 | ||
| 41 | #define mutex_lock(mtx) \ |
41 | #define mutex_lock(mtx) \ |
| 42 | _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING) |
42 | _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE) |
| 43 | #define mutex_trylock(mtx) \ |
43 | #define mutex_trylock(mtx) \ |
| 44 | _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING) |
44 | _mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) |
| 45 | #define mutex_lock_timeout(mtx,usec) \ |
45 | #define mutex_lock_timeout(mtx,usec) \ |
| 46 | _mutex_lock_timeout((mtx),(usec),SYNCH_NON_BLOCKING) |
46 | _mutex_lock_timeout((mtx),(usec),SYNCH_FLAGS_NON_BLOCKING) |
| 47 | #define mutex_lock_active(mtx) \ |
47 | #define mutex_lock_active(mtx) \ |
| 48 | while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC) |
48 | while (mutex_trylock((mtx)) != ESYNCH_OK_ATOMIC) |
| 49 | 49 | ||
| 50 | extern void mutex_initialize(mutex_t *mtx); |
50 | extern void mutex_initialize(mutex_t *mtx); |
| 51 | extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock); |
51 | extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int flags); |
| 52 | extern void mutex_unlock(mutex_t *mtx); |
52 | extern void mutex_unlock(mutex_t *mtx); |
| 53 | 53 | ||
| 54 | #endif |
54 | #endif |