1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
$NetBSD: patch-al,v 1.2 2006/08/01 14:56:06 joerg Exp $
--- src/engine.c.orig 2006-06-30 14:56:00.000000000 +0000
+++ src/engine.c
@@ -36,7 +36,7 @@
se_t *gse; /* global script engine */
xine_t *xine; /* global xine instance */
-pthread_mutex_t engine_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+pthread_mutex_t engine_lock;
gboolean initialised = FALSE;
@@ -299,8 +299,7 @@ static gboolean js_queue_cb (GtkWidget *
while ((js = g_async_queue_try_pop (js_queue)))
{
/* spin; play_exec gets this & the GDK lock in reverse order */
- while (pthread_mutex_trylock (&widgets_update_lock))
- sched_yield ();
+ pthread_mutex_lock (&widgets_update_lock);
pthread_mutex_unlock (&widgets_update_lock); /* JS 'play()' needs it */
engine_exec_obj (js->cmd, js->obj, js->cb, js->cb_data, js->ecb, js->src);
free (js->cmd);
@@ -412,7 +411,12 @@ void engine_init (void)
{
char *cfgfilename;
GtkWidget *w;
+ pthread_mutexattr_t ma;
+ pthread_mutexattr_init(&ma);
+ pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&engine_lock, &ma);
+
/*
* init the global xine engine
*/
|