aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/context.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-08-21 09:35:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-08-21 09:35:31 +0200
commit5182e007931b2ebf034d1a9ed42737ed30b2ac13 (patch)
tree37d1557c2ae7a31bc689d0f87a1c7b9de163dd42 /libbuild2/context.ixx
parent63697e466fb8a5c013d1f32a687ed53eb26f688a (diff)
Don't work own queue in wait_guard dtor
There is suspicion this causes a deadlock for reasons so far unclear. See also GH issue #319.
Diffstat (limited to 'libbuild2/context.ixx')
-rw-r--r--libbuild2/context.ixx14
1 files changed, 11 insertions, 3 deletions
diff --git a/libbuild2/context.ixx b/libbuild2/context.ixx
index 6c8c428..2c62a45 100644
--- a/libbuild2/context.ixx
+++ b/libbuild2/context.ixx
@@ -26,8 +26,11 @@ namespace build2
inline wait_guard::
~wait_guard () noexcept (false)
{
+ // Don't work our own queue since we are most likely in stack unwinding
+ // causes by an exception.
+ //
if (task_count != nullptr)
- wait ();
+ wait (false);
}
inline wait_guard::
@@ -54,10 +57,15 @@ namespace build2
}
inline void wait_guard::
- wait ()
+ wait (bool wq)
{
phase_unlock u (phase ? ctx : nullptr, true /* delay */);
- ctx->sched->wait (start_count, *task_count, u);
+ ctx->sched->wait (start_count,
+ *task_count,
+ u,
+ (wq
+ ? scheduler::work_queue::work_all
+ : scheduler::work_queue::work_none));
task_count = nullptr;
}
}