diff options
author | Dave Houlton <euclid@lindenlab.com> | 2022-04-18 15:35:23 -0600 |
---|---|---|
committer | Dave Houlton <euclid@lindenlab.com> | 2022-04-18 15:35:23 -0600 |
commit | 035b1996df3f357b5060e3eb778588da5b9e7b37 (patch) | |
tree | 270e46eb85dd46fb6962a36a9357dbf31c3afb29 /indra/test/sync.h | |
parent | 2d63d2044e0a00d1969c3da254e016a6e520c0d5 (diff) | |
parent | d031662435d97101411ae990ed85d6e001ab668a (diff) |
Merge branch 'master' into DRTVWR-528
Diffstat (limited to 'indra/test/sync.h')
-rw-r--r-- | indra/test/sync.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/indra/test/sync.h b/indra/test/sync.h index ca8b7262d6..bd837cb730 100644 --- a/indra/test/sync.h +++ b/indra/test/sync.h @@ -89,25 +89,26 @@ public: /// suspend until "somebody else" has bumped mCond by n steps void yield(int n=1) { - return yield_until(STRINGIZE("Sync::yield_for(" << n << ") timed out after " - << int(mTimeout.value()) << "ms"), - mCond.get() + n); + return yield_until("Sync::yield_for", n, mCond.get() + n); } /// suspend until "somebody else" has bumped mCond to a specific value void yield_until(int until) { - return yield_until(STRINGIZE("Sync::yield_until(" << until << ") timed out after " - << int(mTimeout.value()) << "ms"), - until); + return yield_until("Sync::yield_until", until, until); } private: - void yield_until(const std::string& desc, int until) + void yield_until(const char* func, int arg, int until) { std::string name(llcoro::logname()); LL_DEBUGS() << name << " yield_until(" << until << ") suspending" << LL_ENDL; - tut::ensure(name + ' ' + desc, mCond.wait_for_equal(mTimeout, until)); + if (! mCond.wait_for_equal(mTimeout, until)) + { + tut::fail(STRINGIZE(name << ' ' << func << '(' << arg << ") timed out after " + << int(mTimeout.value()) << "ms (expected " << until + << ", actual " << mCond.get() << ')')); + } // each time we wake up, bump mCond bump(); } |