aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-08-06 08:49:09 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-08-06 08:21:10 +0000
commitd09987bf4245ee5e985530f65901855f39f273a3 (patch)
tree4f547d42e5f511b14230b08b565e2f85ba9e694b /executor/executor.cc
parente1bdb00a5405a6f7a63704d60d7b3d9f37731821 (diff)
executor: fix coverage collection in snapshot mode
Fixes #5143
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index b550fc0cf..35fa27c47 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -1372,11 +1372,13 @@ void* worker_thread(void* arg)
{
thread_t* th = (thread_t*)arg;
current_thread = th;
- if (cover_collection_required())
- cover_enable(&th->cov, flag_comparisons, false);
- for (;;) {
+ for (bool first = true;; first = false) {
event_wait(&th->ready);
event_reset(&th->ready);
+ // Setup coverage only after receiving the first ready event
+ // because in snapshot mode we don't know coverage mode for precreated threads.
+ if (first && cover_collection_required())
+ cover_enable(&th->cov, flag_comparisons, false);
execute_call(th);
event_set(&th->done);
}