+/**
+ * Waits until the LibVLC instance gets an exit signal. Normally, this happens
+ * when the user "exits" an interface plugin.
+ */
+void libvlc_InternalWait( libvlc_int_t *p_libvlc )
+{
+ libvlc_priv_t *priv = libvlc_priv( p_libvlc );
+ vlc_object_internals_t *internals = vlc_internals( p_libvlc );
+
+ vlc_object_lock( p_libvlc );
+ while( vlc_object_alive( p_libvlc ) )
+ vlc_cond_wait( &priv->exiting, &internals->lock );
+ vlc_object_unlock( p_libvlc );
+}
+
+/**
+ * Posts an exit signal to LibVLC instance. This will normally initiate the
+ * cleanup and destroy process. It should only be called on behalf of the user.
+ */
+void libvlc_Quit( libvlc_int_t *p_libvlc )
+{
+ libvlc_priv_t *priv = libvlc_priv( p_libvlc );
+
+ vlc_object_kill( p_libvlc );
+ vlc_cond_signal( &priv->exiting ); /* OK, kill took care of the lock */
+}
+