diff --git a/include/osv/condvar.h b/include/osv/condvar.h index 894c927c209e682feef40054548964990657adee..9a399910cbffc8aadda5f76bcec5bc304943ce04 100644 --- a/include/osv/condvar.h +++ b/include/osv/condvar.h @@ -45,6 +45,7 @@ typedef struct condvar { // In C++, for convenience also provide methods. condvar() { memset(this, 0, sizeof *this); } inline int wait(mutex_t *user_mutex, sched::timer *tmr = nullptr); + inline int wait(mutex_t &user_mutex, sched::timer *tmr = nullptr); inline void wake_one(); inline void wake_all(); template <class Pred> @@ -71,6 +72,9 @@ int condvar_wait(condvar_t *condvar, mutex_t *user_mutex, sched::timer *tmr); int condvar_t::wait(mutex_t *user_mutex, sched::timer *tmr) { return condvar_wait(this, user_mutex, tmr); } +int condvar_t::wait(mutex_t &user_mutex, sched::timer *tmr) { + return condvar_wait(this, &user_mutex, tmr); +} void condvar_t::wake_one() { return condvar_wake_one(this); }