1 #include <sys/condvar.h>
2 #include <sys/spinlock2.h>
7 cv_init(struct cv *c, const char *desc)
11 spin_init(&c->cv_lock);
15 cv_destroy(struct cv *c)
17 spin_uninit(&c->cv_lock);
21 _cv_timedwait(struct cv *c, struct lock *l, int timo, int wakesig)
23 int flags = wakesig ? PCATCH : 0;
26 spin_lock_wr(&c->cv_lock);
27 tsleep_interlock(c, flags);
29 spin_unlock_wr(&c->cv_lock);
31 lockmgr(l, LK_RELEASE);
32 error = tsleep(c, flags, c->cv_desc, timo);
34 lockmgr(l, LK_EXCLUSIVE);
40 _cv_signal(struct cv *c, int broadcast)
42 spin_lock_wr(&c->cv_lock);
43 if (c->cv_waiters == 0)
55 spin_unlock_wr(&c->cv_lock);