vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Nov 29 12:39:18 2020 +0200| [7adefbdd15ad84a0dcba4df95de0d0ba5366664f] | committer: Rémi Denis-Courmont
cli: don't create listener thread for console mode > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7adefbdd15ad84a0dcba4df95de0d0ba5366664f --- modules/control/cli/cli.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c index 5c10cd9ce4..0196b26d57 100644 --- a/modules/control/cli/cli.c +++ b/modules/control/cli/cli.c @@ -510,10 +510,10 @@ static void *Run(void *data) intf_thread_t *intf = data; intf_sys_t *sys = intf->p_sys; - while (sys->pi_socket_listen != NULL) - { - assert(sys->pi_socket_listen != NULL); + assert(sys->pi_socket_listen != NULL); + for (;;) + { int fd = net_Accept(intf, sys->pi_socket_listen); if (fd == -1) continue; @@ -529,8 +529,6 @@ static void *Run(void *data) vlc_mutex_unlock(&sys->clients_lock); } } - - return NULL; } #else @@ -944,8 +942,8 @@ static int Activate( vlc_object_t *p_this ) goto error; vlc_list_append(&cl->node, &p_sys->clients); } + else #endif - if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) ) goto error; @@ -976,8 +974,14 @@ static void Deactivate( vlc_object_t *p_this ) intf_thread_t *p_intf = (intf_thread_t*)p_this; intf_sys_t *p_sys = p_intf->p_sys; - vlc_cancel( p_sys->thread ); - vlc_join( p_sys->thread, NULL ); +#ifndef _WIN32 + if (p_sys->pi_socket_listen != NULL) +#endif + { + vlc_cancel(p_sys->thread); + vlc_join(p_sys->thread, NULL); + } + DeregisterPlayer(p_intf, p_sys->player_cli); #ifndef _WIN32 _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
