summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/xine-engine/events.c5
-rw-r--r--src/xine-engine/xine.c9
-rw-r--r--src/xine-engine/xine_internal.h3
4 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b8a1a628..fa511c32d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,8 @@ xine-lib (1.0.2)
* add a new error message when a file we tried to play is an empty
(zero-sized) file
* be more POSIX-compliant (head, tail) (build fix)
+ * fixed deadlock when libxine was called from the event listener thread and
+ tried to flush all pending events.
xine-lib (1.0.1)
* Big XvMC quality / correctness / cpu-usage fix. [bug #1114517]
diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c
index 61fd01e04..e7aa28772 100644
--- a/src/xine-engine/events.c
+++ b/src/xine-engine/events.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: events.c,v 1.26 2004/04/16 16:34:22 hadess Exp $
+ * $Id: events.c,v 1.27 2005/06/13 00:32:12 miguelfreitas Exp $
*
* Event handling functions
*
@@ -116,6 +116,7 @@ xine_event_queue_t *xine_event_new_queue (xine_stream_t *stream) {
queue->events = xine_list_new ();
queue->stream = stream;
queue->listener_thread = NULL;
+ queue->callback_running = 0;
pthread_mutex_lock (&stream->event_queues_lock);
xine_list_append_content (stream->event_queues, queue);
@@ -200,7 +201,9 @@ static void *listener_loop (void *queue_gen) {
if (event->type == XINE_EVENT_QUIT)
running = 0;
+ queue->callback_running = 1;
queue->callback (queue->user_data, event);
+ queue->callback_running = 0;
xine_event_free (event);
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index f9639e89e..7a701cf22 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.c,v 1.312 2005/03/06 11:08:40 tmattern Exp $
+ * $Id: xine.c,v 1.313 2005/06/13 00:32:13 miguelfreitas Exp $
*/
/*
@@ -624,7 +624,12 @@ void _x_flush_events_queues (xine_stream_t *stream) {
pthread_mutex_lock (&queue->lock);
pthread_mutex_unlock (&stream->event_queues_lock);
- if (queue->listener_thread != NULL) {
+ /* we might have been called from the very same function that
+ * processes events, therefore waiting here would cause deadlock.
+ * check only queues with listener threads which are not
+ * currently executing their callback functions.
+ */
+ if (queue->listener_thread != NULL && !queue->callback_running) {
while (!xine_list_is_empty (queue->events)) {
pthread_cond_wait (&queue->events_processed, &queue->lock);
}
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 2c511d127..301b79a8a 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_internal.h,v 1.164 2005/02/09 20:03:21 tmattern Exp $
+ * $Id: xine_internal.h,v 1.165 2005/06/13 00:32:15 miguelfreitas Exp $
*
*/
@@ -182,6 +182,7 @@ struct xine_event_queue_s {
xine_stream_t *stream;
pthread_t *listener_thread;
xine_event_listener_cb_t callback;
+ int callback_running;
void *user_data;
};