Commit Graph

3 Commits

Author SHA1 Message Date
John McCall
c9bb3041f2 Support work-or-wait patterns a little better in AtomicWaitQueue.
Add a tryReloadAndWait method to Worker (which can only be used
when not the worker thread).  Revise the docs to describe this
sort of pattern as the more standard pattern, which I think is
likely to better reflect common use.
2021-12-16 03:07:45 -05:00
John McCall
8289d04eb1 Make it harder to forget to update an existing AtomicWaitQueue.
The existing uses of AWQ don't need arguments during construction,
but uses that do almost certainly need to update existing instances
if createQueue happens to re-use one.  Users probably aren't going
to think about this proactively by doing something wild like reading
the documentation.  We can point this mistake out to them by making
their code not compile if they call createQueue with arguments
without providing a special method.  This pattern also makes the
actual update code much easier to write, since callers don't need
to specially detect this case.
2021-12-16 03:07:45 -05:00
John McCall
b09e712db2 Add AtomicWaitQueue, a lock/condvar for atomic slow paths. 2021-12-14 15:31:46 -05:00