1 /* Copyright (c) 2013 The Regents of the University of California
2 * Barret Rhoden <brho@cs.berkeley.edu>
3 * See LICENSE for details.
5 * Reader-writer queue locks (sleeping locks).
7 * Readers favor readers; writers favor writers. Check out rwlock.c for more
10 * One consequence of this: "if some reader holds a rwlock, then any other
11 * thread (including itself) can get an rlock". */
13 #ifndef ROS_KERN_RWLOCK_H
14 #define ROS_KERN_RWLOCK_H
16 #include <ros/common.h>
24 struct cond_var readers;
25 struct cond_var writers;
27 typedef struct rwlock rwlock_t;
29 void rwinit(struct rwlock *rw_lock);
30 void rlock(struct rwlock *rw_lock);
31 bool canrlock(struct rwlock *rw_lock);
32 void runlock(struct rwlock *rw_lock);
33 void wlock(struct rwlock *rw_lock);
34 void wunlock(struct rwlock *rw_lock);
36 #endif /* ROS_KERN_RWLOCK_H */