mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
c/multi: Make sure that wait thread has started in creation
Co-authored-by: Ryan Pavlik <ryan.pavlik@collabora.com> Co-authored-by: Jakob Bornecrantz <jakob@collabora.com>
This commit is contained in:
parent
3e9a5da3c6
commit
72dbed3ab5
|
@ -223,6 +223,10 @@ run_func(void *ptr)
|
|||
|
||||
os_thread_helper_lock(&mc->wait_thread.oth);
|
||||
|
||||
// Signal the start funtion that we are enterting the loop.
|
||||
mc->wait_thread.alive = true;
|
||||
os_thread_helper_signal_locked(&mc->wait_thread.oth);
|
||||
|
||||
while (os_thread_helper_is_running_locked(&mc->wait_thread.oth)) {
|
||||
|
||||
if (mc->wait_thread.xcsem == NULL && mc->wait_thread.xcf == NULL) {
|
||||
|
@ -923,6 +927,16 @@ multi_compositor_create(struct multi_system_compositor *msc,
|
|||
// Last start the wait thread.
|
||||
os_thread_helper_start(&mc->wait_thread.oth, run_func, mc);
|
||||
|
||||
os_thread_helper_lock(&mc->wait_thread.oth);
|
||||
|
||||
// Wait for the wait thread to fully start.
|
||||
while (!mc->wait_thread.alive) {
|
||||
os_thread_helper_wait_locked(&mc->wait_thread.oth);
|
||||
}
|
||||
|
||||
os_thread_helper_unlock(&mc->wait_thread.oth);
|
||||
|
||||
|
||||
*out_xcn = &mc->base;
|
||||
|
||||
return XRT_SUCCESS;
|
||||
|
|
|
@ -143,6 +143,9 @@ struct multi_compositor
|
|||
//! The wait thread itself
|
||||
struct os_thread_helper oth;
|
||||
|
||||
//! Have we gotten to the loop?
|
||||
bool alive;
|
||||
|
||||
//! Is the thread waiting, if so the client should block.
|
||||
bool waiting;
|
||||
|
||||
|
|
Loading…
Reference in a new issue