[vlc-commits] ncurses: do not use pf_run

Rémi Denis-Courmont git at videolan.org
Tue Nov 27 19:24:49 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 27 20:12:54 2012 +0200| [aab8de5c7f89f8ac4d50d2aebdb86d32dd69efca] | committer: Rémi Denis-Courmont

ncurses: do not use pf_run

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aab8de5c7f89f8ac4d50d2aebdb86d32dd69efca
---

 modules/gui/ncurses.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index e981dae..4b44119 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -178,6 +178,7 @@ struct pl_item_t
 
 struct intf_sys_t
 {
+    vlc_thread_t    thread;
     input_thread_t *p_input;
 
     bool            color;
@@ -1753,13 +1754,12 @@ static inline void UpdateInput(intf_sys_t *sys, playlist_t *p_playlist)
 /*****************************************************************************
  * Run: ncurses thread
  *****************************************************************************/
-static void Run(intf_thread_t *intf)
+static void *Run(void *data)
 {
+    intf_thread_t *intf = data;
     intf_sys_t    *sys = intf->p_sys;
     playlist_t    *p_playlist = pl_Get(intf);
 
-    int canc = vlc_savecancel();
-
     var_AddCallback(p_playlist, "intf-change", PlaylistChanged, intf);
     var_AddCallback(p_playlist, "item-change", ItemChanged, intf);
     var_AddCallback(p_playlist, "playlist-item-append", PlaylistChanged, intf);
@@ -1773,7 +1773,7 @@ static void Run(intf_thread_t *intf)
     var_DelCallback(p_playlist, "intf-change", PlaylistChanged, intf);
     var_DelCallback(p_playlist, "item-change", ItemChanged, intf);
     var_DelCallback(p_playlist, "playlist-item-append", PlaylistChanged, intf);
-    vlc_restorecancel(canc);
+    return NULL;
 }
 
 /*****************************************************************************
@@ -1824,7 +1824,10 @@ static int Open(vlc_object_t *p_this)
     PlaylistRebuild(intf),
     PL_UNLOCK;
 
-    intf->pf_run = Run;
+    if (vlc_clone(&sys->thread, Run, intf, VLC_THREAD_PRIORITY_LOW))
+        abort(); /* TODO */
+
+    intf->pf_run = NULL;
     return VLC_SUCCESS;
 }
 
@@ -1835,6 +1838,8 @@ static void Close(vlc_object_t *p_this)
 {
     intf_sys_t *sys = ((intf_thread_t*)p_this)->p_sys;
 
+    vlc_join(sys->thread, NULL);
+
     PlaylistDestroy(sys);
     DirsDestroy(sys);
 



More information about the vlc-commits mailing list