mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
wpe: Properly wait on context thread startup condition
Fixes #1661 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2533>
This commit is contained in:
parent
9dfd237741
commit
4af3442d4a
2 changed files with 5 additions and 1 deletions
|
@ -77,7 +77,9 @@ WPEContextThread::WPEContextThread()
|
|||
{
|
||||
GMutexHolder lock(threading.mutex);
|
||||
threading.thread = g_thread_new("WPEContextThread", s_viewThread, this);
|
||||
g_cond_wait(&threading.cond, &threading.mutex);
|
||||
while (!threading.ready) {
|
||||
g_cond_wait(&threading.cond, &threading.mutex);
|
||||
}
|
||||
GST_DEBUG("thread spawned");
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +140,7 @@ gpointer WPEContextThread::s_viewThread(gpointer data)
|
|||
[](gpointer data) -> gboolean {
|
||||
auto& view = *static_cast<WPEContextThread*>(data);
|
||||
GMutexHolder lock(view.threading.mutex);
|
||||
view.threading.ready = TRUE;
|
||||
g_cond_signal(&view.threading.cond);
|
||||
return G_SOURCE_REMOVE;
|
||||
},
|
||||
|
|
|
@ -138,6 +138,7 @@ private:
|
|||
struct {
|
||||
GMutex mutex;
|
||||
GCond cond;
|
||||
gboolean ready;
|
||||
GThread* thread { nullptr };
|
||||
} threading;
|
||||
|
||||
|
|
Loading…
Reference in a new issue