summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2021-10-07 16:45:15 -0400
committerNat Goodspeed <nat@lindenlab.com>2021-10-07 16:45:15 -0400
commitc585ddb75e383cdd994d0d99fed8f2de8f955e3c (patch)
tree9eeb9b6593d5ef4ab31e4cd4678829113af6426a /indra/llcommon/tests
parent623ac79120a417ec445ce5c106a907fe46734309 (diff)
SL-16024: Defend against two threads making "anonymous" WorkQueues.
Also make workqueue_test.cpp more robust.
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r--indra/llcommon/tests/workqueue_test.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/indra/llcommon/tests/workqueue_test.cpp b/indra/llcommon/tests/workqueue_test.cpp
index ab1cae6c14..d5405400fd 100644
--- a/indra/llcommon/tests/workqueue_test.cpp
+++ b/indra/llcommon/tests/workqueue_test.cpp
@@ -103,12 +103,13 @@ namespace tut
Shared result = data.get();
ensure_equals("called wrong number of times", result.size(), 3);
// postEvery() assumes you want the first call to happen right away.
- // Inject a fake start time that's (interval) earlier than that, to
- // make our too early/too late tests uniform for all entries.
- result.push_front(start - interval);
- for (size_t i = 1; i < result.size(); ++i)
+ // Pretend our start time was (interval) earlier than that, to make
+ // our too early/too late tests uniform for all entries.
+ start -= interval;
+ for (size_t i = 0; i < result.size(); ++i)
{
- auto diff = (result[i] - result[i-1]);
+ auto diff = result[i] - start;
+ start += interval;
try
{
ensure(STRINGIZE("call " << i << " too soon"), diff >= interval);