Skip to content

Commit 901118e

Browse files
committed
ThreadSafePool::is_used()
1 parent 59df5a8 commit 901118e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

util/thread_safe_pool.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ public:
4444
return false;
4545
}
4646

47+
// Acquire-load on the slot's used flag. Pairs with the release from create()/destroy()
48+
bool is_used(size_t idx) const {
49+
if (idx >= used_flags.size())
50+
return false;
51+
return used_flags[idx].load(std::memory_order_acquire);
52+
}
53+
4754
void clear() {
4855
for (size_t i = 0; i < MaxEntries; i++) {
4956
data[i] = T{};

0 commit comments

Comments
 (0)