[igt-dev] [PATCH i-g-t v34 38/38] lib/intel_allocator: Wait for allocator thread to be ready
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Tue Apr 13 13:54:41 UTC 2021
Before allowing allocator working in multiprocess mode we have to
ensure it is ready and able to process allocator messages passed
from children.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Jason Ekstrand <jason at jlekstrand.net>
Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
Acked-by: Petri Latvala <petri.latvala at intel.com>
---
lib/intel_allocator.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c
index 8a2e607c3..96f839d4b 100644
--- a/lib/intel_allocator.c
+++ b/lib/intel_allocator.c
@@ -794,10 +794,17 @@ void __intel_allocator_multiprocess_prepare(void)
channel->init(channel);
}
+#define START_TIMEOUT_MS 100
void __intel_allocator_multiprocess_start(void)
{
+ int time_left = START_TIMEOUT_MS;
+
pthread_create(&allocator_thread, NULL,
allocator_thread_loop, NULL);
+
+ /* Wait unless allocator thread get started */
+ while (time_left-- > 0 && !READ_ONCE(allocator_thread_running))
+ usleep(1000);
}
/**
--
2.26.0
More information about the igt-dev
mailing list