[vlc-devel] [PATCH 5/6] qt4: Run mainloop on the main thread on OSX
Rémi Denis-Courmont
remi at remlab.net
Sat Jul 24 22:56:21 CEST 2010
Le samedi 24 juillet 2010 23:31:13 Juho Vähä-Herttua, vous avez écrit :
> @@ -335,9 +344,14 @@ static int Open( vlc_object_t *p_this, bool
> isDialogProvider ) return VLC_ENOMEM;
> }
>
> - /* */
> +#ifndef Q_WS_MAC
> + /* Wait until the interface is initialized, This is to avoid a race
> + * condition where playlist is started before the interface is
> initialized + * and therefore first video is not run in the embedded
> window. On Mac the + * interface is run on main thread so this problem
> doesn't exist, playlist + * needs to be started explicitly for Mac OS
> X. */
> vlc_sem_wait (&ready);
> - vlc_sem_destroy (&ready);
Seems wrong.
> +#endif
>
> if( !p_sys->b_isDialogProvider )
> {
> @@ -376,6 +390,7 @@ static void Close( vlc_object_t *p_this )
> QVLCApp::triggerQuit();
>
> vlc_join (p_sys->thread, NULL);
> + vlc_sem_destroy (&ready);
> #ifdef Q_WS_X11
> free (x11_display);
> x11_display = NULL;
> @@ -460,7 +475,7 @@ static void *Thread( void *obj )
> /* Explain how to show a dialog :D */
> p_intf->pf_show_dialog = ShowDialog;
>
> - /* */
> + /* Notify that the interface is initialized */
> vlc_sem_post (&ready);
>
> /* Last settings */
> @@ -478,6 +493,9 @@ static void *Thread( void *obj )
> /* Launch */
> app.exec();
>
> + /* Notify that the interface is cleaned up */
> + vlc_sem_post (&ready);
> +
> /* Delete the application automatically */
> return NULL;
> }
> @@ -524,6 +542,20 @@ static void Cleanup( void *obj )
> MainInputManager::killInstance();
> }
>
> +static void *Monitor( void *obj )
> +{
> + intf_thread_t *p_intf = (intf_thread_t *)obj;
> +
> + /* Wait for interface to initialize */
> + vlc_sem_wait (&ready);
> +
> + /* Wait for interface to cleanup */
> + vlc_sem_wait (&ready);
> +
> + msg_Dbg( p_intf, "Monitor thread finished" );
> + return NULL;
> +}
That thread looks quite useless.
--
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
More information about the vlc-devel
mailing list