[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Original]
[xine-devel] [PATCH] Make catalog mutex recursive (was:_x_load_video_out
On Tue, 2005-11-22 at 12:54 -0500, Jason Tackaberry wrote:
> deadlock, because this function doesn't allow recursion. (The function
> first acquires a lock on catalog->lock, and reentry will of course
> deadlock.)
The attached patch makes the catalog mutex recursive, which fixes my
problem and allows the driver's open_plugin to call
_x_load_video_output_plugin(). Neither pthread_cond_wait nor
pthread_cond_timedwait are used on this mutex, and some cursory testing
hasn't shown any negative side effects.
Still, threads are insidious, so review definitely required. :) If
there are no objections, I can commit it.
Cheers,
Jason.
--- xine-lib.orig/src/xine-engine/load_plugins.c 2005-09-19
12:14:02.000000000 -0400
+++ xine-lib/src/xine-engine/load_plugins.c 2005-11-25 08:41:29.000000000
-0500
@@ -437,6 +437,7 @@
static plugin_catalog_t *_new_catalog(void){
plugin_catalog_t *catalog;
+ pthread_mutexattr_t attr;
int i;
catalog = xine_xmalloc(sizeof(plugin_catalog_t));
@@ -447,7 +448,9 @@
catalog->cache_list = xine_list_new();
catalog->file_list = xine_list_new();
- pthread_mutex_init (&catalog->lock, NULL);
+ pthread_mutexattr_init (&attr);
+ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init (&catalog->lock, &attr);
return catalog;
}
signature.asc
Description: This is a digitally signed message part