Rev 2680 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2680 | Rev 2681 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | #include <sys/types.h> |
42 | #include <sys/types.h> |
43 | #include <futex.h> |
43 | #include <futex.h> |
44 | 44 | ||
45 | typedef atomic_t rwlock_t; |
45 | typedef atomic_t rwlock_t; |
46 | 46 | ||
- | 47 | #define RWLOCK_INITIALIZE(rwlock) \ |
|
- | 48 | rwlock_t rwlock = FUTEX_INITIALIZER |
|
- | 49 | ||
47 | #define rwlock_initialize(rwlock) futex_initialize((rwlock), 1) |
50 | #define rwlock_initialize(rwlock) futex_initialize((rwlock), 1) |
48 | #define rwlock_reader_lock(rwlock) futex_down((rwlock)) |
51 | #define rwlock_reader_lock(rwlock) futex_down((rwlock)) |
49 | #define rwlock_writer_lock(rwlock) futex_down((rwlock)) |
52 | #define rwlock_writer_lock(rwlock) futex_down((rwlock)) |
50 | #define rwlock_reader_unlock(rwlock) futex_up((rwlock)) |
53 | #define rwlock_reader_unlock(rwlock) futex_up((rwlock)) |
51 | #define rwlock_writer_unlock(rwlock) futex_up((rwlock)) |
54 | #define rwlock_writer_unlock(rwlock) futex_up((rwlock)) |