Commit Graph

8 Commits (63494cf5c9157db76e57ccddb241d759b716813f)

Author SHA1 Message Date
Nat Goodspeed 04ebc11a2d SL-16094: Fix WorkQueue test for correct behavior of runFor().
Turns out that one of our WorkQueue integration tests was relying on the
incorrect runFor() behavior that we just fixed, so the test broke. Now that
runFor() doesn't wait around for work to be posted, use an explicit wait loop
instead.

To support this, add LLCond::get(functor), where functor must accept a const
reference to the stored data. This new get() returns whatever the functor
returns, allowing a caller to peek at the stored data.

Also use universal references for all remaining LLCond functor arguments.
2021-11-24 12:56:48 -05:00
Nat Goodspeed 6e06d1db60 SL-16024: Make LLCond::get() lock and return by value.
Its previous behavior, returning a const reference without locking, was wrong:
it could return a reference to an object in an inconsistent state if it was
concurrently being modified on another thread.

Locking the mutex and returning a copy by value is the correct behavior.
2021-10-07 15:32:19 -04:00
Nat Goodspeed 98dfba0d2f DRTVWR-476: Wrap boost::fibers::mutex et al. with LLCoros aliases.
Specifically:

LLCoros::Mutex means boost::fibers::mutex
LLCoros::LockType means std::unique_lock<boost::fibers::mutex>
LLCoros::ConditionVariable means boost::fibers::condition_variable
LLCoros::cv_status means boost::fibers::cv_status

So as not to drag in all of boost::fibers::mutex.hpp or condition_variable.hpp
for each consumer of llcoros.h, instead #define LLCOROS_MUTEX_HEADER and
LLCOROS_CONDVAR_HEADER. Those who need them can #include the relevant macro.

Update llcond.h and llthreadsafequeue.h accordingly.
2020-05-14 14:51:52 -04:00
Nat Goodspeed 3810145c1d DRTVWR-476: Fix first round of compile errors. 2020-03-25 18:44:04 -04:00
Nat Goodspeed 72863b9428 DRTVWR-476: Fix convert(F32Milliseconds) 2020-03-25 18:44:04 -04:00
Nat Goodspeed 7e2cc57d61 DRTVWR-476: Review response: remove wait_until() methods and LLDate. 2020-03-25 18:44:04 -04:00
Nat Goodspeed a3de18996f DRTVWR-476: Review response: support LLDate and llunits.h durations.
Also introduce value_type typedef.
2020-03-25 18:44:04 -04:00
Nat Goodspeed d8e08ecde9 DRTVWR-476: WIP: Untested preliminary implementation of LLCond.
LLCond encapsulates the usage patterns required to properly use
condition_variable. We also provide LLScalarCond, LLBoolCond and LLOneShotCond.
2020-03-25 18:44:04 -04:00