From f5e6b3aae305730a3bdb82985b0d0c8ba6011941 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sat, 19 Mar 2022 20:12:00 +0100 Subject: [PATCH] rusticl/event: timeout wait on condvar to abort on reaped worker threads Signed-off-by: Karol Herbst Acked-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/core/event.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/rusticl/core/event.rs b/src/gallium/frontends/rusticl/core/event.rs index cfa09c0c83c..f91b2c339d0 100644 --- a/src/gallium/frontends/rusticl/core/event.rs +++ b/src/gallium/frontends/rusticl/core/event.rs @@ -19,6 +19,7 @@ use std::sync::Arc; use std::sync::Condvar; use std::sync::Mutex; use std::sync::MutexGuard; +use std::time::Duration; // we assert that those are a continous range of numbers so we won't have to use HashMaps static_assert!(CL_COMPLETE == 0); @@ -147,7 +148,11 @@ impl Event { self.set_status(&mut lock, CL_RUNNING as cl_int); self.set_status(&mut lock, CL_COMPLETE as cl_int); } else { - lock = self.cv.wait(lock).unwrap(); + lock = self + .cv + .wait_timeout(lock, Duration::from_millis(50)) + .unwrap() + .0; } } lock.status