mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
made cond_wait into cond_timedwait
Original commit message from CVS: made cond_wait into cond_timedwait
This commit is contained in:
parent
4f74cacc80
commit
33b6cb333e
1 changed files with 15 additions and 6 deletions
|
@ -394,13 +394,22 @@ static void
|
|||
gst_thread_wait_thread (GstThread *thread, guint syncflag, gboolean set)
|
||||
{
|
||||
// if (!thread->signaling) {
|
||||
g_mutex_lock (thread->lock);
|
||||
GST_DEBUG (0,"sync: waiting for thread for %u to be set %d\n",
|
||||
syncflag,set);
|
||||
if (GST_FLAG_IS_SET(thread,syncflag)!=set) {
|
||||
g_cond_wait (thread->cond, thread->lock);
|
||||
GTimeVal finaltime;
|
||||
g_mutex_lock (thread->lock);
|
||||
GST_DEBUG (0,"sync: waiting for thread for %u to be set %d\n",
|
||||
syncflag,set);
|
||||
while (GST_FLAG_IS_SET(thread,syncflag)!=set) {
|
||||
g_get_current_time(&finaltime);
|
||||
if (finaltime.tv_usec>995000) {
|
||||
finaltime.tv_sec++;
|
||||
finaltime.tv_usec=5000-(1000000-finaltime.tv_usec);
|
||||
}
|
||||
g_mutex_unlock (thread->lock);
|
||||
else {
|
||||
finaltime.tv_usec+=5000;
|
||||
}
|
||||
g_cond_timed_wait (thread->cond, thread->lock,&finaltime);
|
||||
}
|
||||
g_mutex_unlock (thread->lock);
|
||||
GST_DEBUG (0, "sync: done waiting for thread\n");
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue