Changes in kernel/generic/include/synch/mutex.h [e88eb48:9f2f5ee] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/mutex.h
re88eb48 r9f2f5ee 44 44 MUTEX_PASSIVE, 45 45 MUTEX_RECURSIVE, 46 MUTEX_ACTIVE47 46 } mutex_type_t; 48 47 … … 51 50 typedef struct { 52 51 mutex_type_t type; 52 int nesting; 53 53 semaphore_t sem; 54 struct thread *owner; 55 unsigned nesting; 54 _Atomic(struct thread *) owner; 56 55 } mutex_t; 57 56 58 #define mutex_lock(mtx) \ 59 _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 57 #define MUTEX_INITIALIZER(name, mtype) (mutex_t) { \ 58 .type = (mtype), \ 59 .nesting = 0, \ 60 .sem = SEMAPHORE_INITIALIZER((name).sem, 1), \ 61 .owner = NULL, \ 62 } 60 63 61 #define mutex_trylock(mtx) \ 62 _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) 63 64 #define mutex_lock_timeout(mtx, usec) \ 65 _mutex_lock_timeout((mtx), (usec), SYNCH_FLAGS_NON_BLOCKING) 64 #define MUTEX_INITIALIZE(name, mtype) \ 65 mutex_t name = MUTEX_INITIALIZER(name, mtype) 66 66 67 67 extern void mutex_initialize(mutex_t *, mutex_type_t); 68 68 extern bool mutex_locked(mutex_t *); 69 extern errno_t _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int); 69 extern errno_t mutex_trylock(mutex_t *); 70 extern void mutex_lock(mutex_t *); 71 extern errno_t mutex_lock_timeout(mutex_t *, uint32_t); 70 72 extern void mutex_unlock(mutex_t *); 71 73
Note:
See TracChangeset
for help on using the changeset viewer.