Update of /cvsroot/xine/xine-lib/src/xine-engine In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18822
Modified Files: xine.c Log Message: Added some cleanup code to make some calls cancelable (at least xine_open can be safely canceled now). Index: xine.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/xine-engine/xine.c,v retrieving revision 1.337 retrieving revision 1.338 diff -u -r1.337 -r1.338 --- xine.c 18 Dec 2006 21:22:45 -0000 1.337 +++ xine.c 19 Dec 2006 14:10:35 -0000 1.338 @@ -78,6 +78,10 @@ #endif /* WIN32 */ +static void mutex_cleanup (void *mutex) { + pthread_mutex_unlock ((pthread_mutex_t *) mutex); +} + void _x_handle_stream_end (xine_stream_t *stream, int non_user) { if (stream->status == XINE_STATUS_QUIT) @@ -294,6 +298,7 @@ void xine_stop (xine_stream_t *stream) { pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); /* make sure that other threads cannot change the speed, especially pauseing the stream */ pthread_mutex_lock(&stream->speed_change_lock); @@ -320,6 +325,7 @@ stream->xine->port_ticket->release(stream->xine->port_ticket, 1); stream->ignore_speed_change = 0; + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); } @@ -395,6 +401,7 @@ void xine_close (xine_stream_t *stream) { pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); close_internal (stream); @@ -408,6 +415,7 @@ if (stream->status != XINE_STATUS_QUIT) stream->status = XINE_STATUS_IDLE; + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); } @@ -1134,11 +1142,13 @@ int ret; pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); lprintf ("open MRL:%s\n", mrl); ret = open_internal (stream, mrl); + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); return ret; @@ -1266,6 +1276,7 @@ int ret; pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); stream->delay_finish_event = 0; @@ -1275,6 +1286,7 @@ stream->gapless_switch = 0; + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); return ret; @@ -1288,6 +1300,7 @@ return 0; pthread_mutex_lock (&stream->frontend_lock); + pthread_cleanup_push (mutex_cleanup, (void *) &stream->frontend_lock); status = 0; /* only eject, if we are stopped OR a different input plugin is playing */ @@ -1298,7 +1311,9 @@ status = stream->eject_class->eject_media (stream->eject_class); } + pthread_cleanup_pop (0); pthread_mutex_unlock (&stream->frontend_lock); + return status; } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Xine-cvslog mailing list Xine-cvslog@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xine-cvslog