mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 10:51:52 -04:00
Document tasks_pending() as an approximate metric
tasks_pending() reads _tasks_enqueued and _tasks_completed in two separate relaxed loads. Between the loads, additional tasks can complete, making the result transiently inconsistent (the (e > c) guard prevents underflow but not staleness). Add a comment clarifying that this is intentionally approximate and should not be used for synchronization decisions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
db784e00a2
commit
c2da86d6da
1 changed files with 4 additions and 0 deletions
|
|
@ -1052,6 +1052,10 @@ ThreadPool::tasks_completed() const
|
|||
return _tasks_completed.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
// Approximate: the two counters are loaded non-atomically with
|
||||
// relaxed ordering, so the result may momentarily read zero (or
|
||||
// a lower value) while tasks complete between the two loads.
|
||||
// Suitable for monitoring and heuristics, not for synchronization.
|
||||
inline
|
||||
std::uint64_t
|
||||
ThreadPool::tasks_pending() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue