diff options
author | Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> | 2021-04-12 11:32:14 +0200 |
---|---|---|
committer | Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> | 2021-04-13 15:44:38 +0200 |
commit | 48d89e2c65c54883b0776930a884e6d3bcefb45b (patch) | |
tree | 82e19c60a24a5efebb653beae2f2be2ec5d2084d /lib | |
parent | 35b7416e7f458ad7aa61af2a840982db1d2dd451 (diff) |
lib/intel_allocator: Wait for allocator thread to be ready
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@intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/intel_allocator.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c index 8a2e607c..96f839d4 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); } /** |