Changes in kernel/generic/include/synch/mutex.h [9f2f5ee:e88eb48] in mainline
- File:
-
- 1 edited
-
kernel/generic/include/synch/mutex.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/mutex.h
r9f2f5ee re88eb48 44 44 MUTEX_PASSIVE, 45 45 MUTEX_RECURSIVE, 46 MUTEX_ACTIVE 46 47 } mutex_type_t; 47 48 … … 50 51 typedef struct { 51 52 mutex_type_t type; 52 int nesting;53 53 semaphore_t sem; 54 _Atomic(struct thread *) owner; 54 struct thread *owner; 55 unsigned nesting; 55 56 } mutex_t; 56 57 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 } 58 #define mutex_lock(mtx) \ 59 _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 63 60 64 #define MUTEX_INITIALIZE(name, mtype) \ 65 mutex_t name = MUTEX_INITIALIZER(name, mtype) 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) 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_trylock(mutex_t *); 70 extern void mutex_lock(mutex_t *); 71 extern errno_t mutex_lock_timeout(mutex_t *, uint32_t); 69 extern errno_t _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int); 72 70 extern void mutex_unlock(mutex_t *); 73 71
Note:
See TracChangeset
for help on using the changeset viewer.
