Rev 4522 | Rev 4527 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4522 | Rev 4526 | ||
|---|---|---|---|
| Line 53... | Line 53... | ||
| 53 | .next = &name.waiters, \ |
53 | .next = &name.waiters, \ |
| 54 | } \ |
54 | } \ |
| 55 | } |
55 | } |
| 56 | 56 | ||
| 57 | typedef struct { |
57 | typedef struct { |
| - | 58 | unsigned writers; |
|
| - | 59 | unsigned readers; |
|
| 58 | fibril_mutex_t fm; |
60 | link_t waiters; |
| 59 | } fibril_rwlock_t; |
61 | } fibril_rwlock_t; |
| 60 | 62 | ||
| 61 | #define FIBRIL_RWLOCK_INITIALIZE(name) \ |
63 | #define FIBRIL_RWLOCK_INITIALIZE(name) \ |
| 62 | fibril_rwlock_t name = { \ |
64 | fibril_rwlock_t name = { \ |
| 63 | .fm = { \ |
65 | .readers = 0, \ |
| 64 | .counter = 1, \ |
66 | .writers = 0, \ |
| 65 | .waiters = { \ |
67 | .waiters = { \ |
| 66 | .prev = &name.fm.waiters, \ |
68 | .prev = &name.waiters, \ |
| 67 | .next = &name.fm.waiters, \ |
69 | .next = &name.waiters, \ |
| 68 | } \ |
- | |
| 69 | } \ |
70 | } \ |
| 70 | } |
71 | } |
| 71 | 72 | ||
| 72 | extern void fibril_mutex_initialize(fibril_mutex_t *); |
73 | extern void fibril_mutex_initialize(fibril_mutex_t *); |
| 73 | extern void fibril_mutex_lock(fibril_mutex_t *); |
74 | extern void fibril_mutex_lock(fibril_mutex_t *); |