Skip to content

Commit d68ad22

Browse files
committed
Add racy_queue_size() to ThreadTask for statistics
1 parent 6a9825c commit d68ad22

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/tinykvm/util/threadtask.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class ThreadTask {
2525
void set_low_prio(bool low_prio) { m_prio_low = low_prio; }
2626
~ThreadTask();
2727

28+
size_t racy_queue_size() {
29+
std::unique_lock<std::mutex> lock(queue_mutex);
30+
return tasks.size();
31+
}
32+
2833
private:
2934
void start_worker(std::unique_lock<std::mutex> const& lock);
3035

0 commit comments

Comments
 (0)