[vlc-commits] Revert "Remove b_should_run_on_first_thread"
Rémi Denis-Courmont
git at videolan.org
Wed May 9 18:53:06 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 9 17:52:25 2012 +0300| [235cac9677f47bfdb07a982573885de8063d6aad] | committer: Rémi Denis-Courmont
Revert "Remove b_should_run_on_first_thread"
This reverts commit 4dc0b22b3371235fc1295a52d26562c979e87c5a.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=235cac9677f47bfdb07a982573885de8063d6aad
---
include/vlc_interface.h | 4 ++++
src/interface/interface.c | 19 +++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index 5c761c2..14898e3 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -53,6 +53,10 @@ typedef struct intf_thread_t
struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
vlc_thread_t thread; /** LibVLC thread */
+ /* Thread properties and locks */
+#if defined( __APPLE__ )
+ bool b_should_run_on_first_thread;
+#endif
/* Specific interfaces */
intf_sys_t * p_sys; /** system interface */
diff --git a/src/interface/interface.c b/src/interface/interface.c
index b30cdb4..b3a7c48 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -106,6 +106,11 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL );
+ /* Attach interface to LibVLC */
+#if defined( __APPLE__ )
+ p_intf->b_should_run_on_first_thread = false;
+#endif
+
/* Choose the best module */
p_intf->p_cfg = NULL;
char *psz_parser = *chain == '$'
@@ -124,6 +129,17 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
goto error;
}
+#if defined( __APPLE__ )
+ /* Hack to get Mac OS X Cocoa runtime running
+ * (it needs access to the main thread) */
+ if( p_intf->b_should_run_on_first_thread )
+ {
+ libvlc_SetExitHandler( p_libvlc, vlc_object_kill, p_intf );
+ assert( p_intf->pf_run );
+ p_intf->pf_run( p_intf );
+ }
+ else
+#endif
/* Run the interface in a separate thread */
if( p_intf->pf_run
&& vlc_clone( &p_intf->thread,
@@ -176,6 +192,9 @@ void intf_DestroyAll( libvlc_int_t *p_libvlc )
if( p_intf->pf_run )
{
vlc_cancel( p_intf->thread );
+#ifdef __APPLE__
+ if (!p_intf->b_should_run_on_first_thread)
+#endif
vlc_join( p_intf->thread, NULL );
}
module_unneed( p_intf, p_intf->p_module );
More information about the vlc-commits
mailing list