0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::ctx: Add functions to peek at the queue size of the mutexes.

This commit is contained in:
Jason Volk 2018-03-06 01:09:37 -08:00
parent 191c9db5c0
commit 29f08d3615
2 changed files with 18 additions and 0 deletions

View file

@ -29,6 +29,8 @@ class ircd::ctx::mutex
list q;
public:
size_t waiting() const;
bool try_lock();
template<class time_point> bool try_lock_until(const time_point &);
template<class duration> bool try_lock_for(const duration &);
@ -131,6 +133,13 @@ ircd::ctx::mutex::try_lock()
return true;
}
inline size_t
ircd::ctx::mutex::waiting()
const
{
return q.size();
}
template<class queue>
void
ircd::ctx::release_sequence(queue &q)

View file

@ -25,6 +25,8 @@ class ircd::ctx::shared_mutex
void release();
public:
size_t waiting() const;
bool try_lock();
bool try_lock_shared();
bool try_lock_upgrade();
@ -351,6 +353,13 @@ ircd::ctx::shared_mutex::try_lock()
return true;
}
inline size_t
ircd::ctx::shared_mutex::waiting()
const
{
return q.size();
}
inline void
ircd::ctx::shared_mutex::release()
{