[vlc-devel] commit: Tentative hack for OSX msleep/mwait cancellation ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Dec 21 18:15:57 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Dec 21 19:15:29 2008 +0200| [3b6ed8084e27fa27f51d3abdeb37052ea9af38fb] | committer: Rémi Denis-Courmont
Tentative hack for OSX msleep/mwait cancellation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b6ed8084e27fa27f51d3abdeb37052ea9af38fb
---
src/misc/mtime.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/src/misc/mtime.c b/src/misc/mtime.c
index bc622c1..96049e5 100644
--- a/src/misc/mtime.c
+++ b/src/misc/mtime.c
@@ -350,6 +350,25 @@ void mwait( mtime_t date )
}
vlc_testcancel();
+#elif defined( __APPLE__ )
+ /* Explicit hack: OSX does not cancel at nanosleep() */
+ struct vlc_mutex_t lock;
+ struct vlc_cond_t wait;
+
+ vlc_mutex_init (&lock);
+ vlc_cond_init (&wait);
+ vlc_mutex_lock (&lock);
+
+ vlc_cleanup_push (vlc_mutex_destroy, &lock);
+ vlc_cleanup_push (vlc_cond_destroy, &wait);
+ vlc_cleanup_push (vlc_mutex_unlock, &lock);
+
+ vlc_cond_timedwait (&wait, &lock, date);
+
+ vlc_cleanup_run ();
+ vlc_cleanup_run ();
+ vlc_cleanup_run ();
+
#else
mtime_t delay = date - mdate();
if( delay > 0 )
@@ -398,7 +417,7 @@ void msleep( mtime_t delay )
#elif defined( HAVE_KERNEL_OS_H )
snooze( delay );
-#elif defined( WIN32 ) || defined( UNDER_CE )
+#elif defined( WIN32 ) || defined( UNDER_CE ) || defined( __APPLE__ )
mwait (mdate () + delay);
#elif defined( HAVE_NANOSLEEP )
More information about the vlc-devel
mailing list