<html><head></head><body>It does simplify the code on objective complexity metrics. And that ship has sailed about ten years ago.<br><br>And I don't think it's okay to pick on one developer. I was not the first to push code without review lately. And I am also not the only person to disagree with systematic review.<br><br><div class="gmail_quote">Le 9 mai 2019 10:35:47 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Hello,<br><br>This doesn't simplify at all, thread_cancel is very complicated, I wold have preferred a cond + bool.<br><br>You should propose all your patches changing the core to the ML. Since they always have to be reviewed anyway when we switch to gitlab soon.<br><br>On Wed, May 8, 2019, at 20:21, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">vlc | branch: master | Rémi Denis-Courmont <remi@remlab.net> | Wed May <br>8 19:20:53 2019 +0300| [949204f27498bd21e8d269b5aa9b80c7ec84a435] | <br>committer: Rémi Denis-Courmont<br><br>vout: cancel the thread and simplify<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"><a href="http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=949204f27498bd21e8d269b5aa9b80c7ec84a435">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=949204f27498bd21e8d269b5aa9b80c7ec84a435</a><br></blockquote><hr> src/video_output/control.h | 7 -------<br> src/video_output/video_output.c | 24 ++++++++++++------------<br> 2 files changed, 12 insertions(+), 19 deletions(-)<br> <br> diff --git a/src/video_output/control.h b/src/video_output/control.h<br> index 46b78122e4..b189b6478a 100644<br> --- a/src/video_output/control.h<br> +++ b/src/video_output/control.h<br> @@ -27,13 +27,6 @@<br> <br> /* */<br> enum {<br> - VOUT_CONTROL_CLEAN,<br> -<br> -#if 0<br> - /* */<br> - VOUT_CONTROL_START,<br> - VOUT_CONTROL_STOP,<br> -#endif<br> VOUT_CONTROL_CHANGE_FILTERS, /* string */<br> VOUT_CONTROL_CHANGE_INTERLACE, /* boolean */<br> <br> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br> index 2a76ad5c00..b84336ac23 100644<br> --- a/src/video_output/video_output.c<br> +++ b/src/video_output/video_output.c<br> @@ -33,6 +33,8 @@<br> # include "config.h"<br> #endif<br> <br> +#include <stdnoreturn.h><br> +<br> #include <vlc_common.h><br> <br> #include <math.h><br> @@ -1527,11 +1529,9 @@ void vout_Cancel(vout_thread_t *vout, bool canceled)<br> vout_control_Release(&sys->control);<br> }<br> <br> -static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)<br> +static void ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)<br> {<br> switch(cmd.type) {<br> - case VOUT_CONTROL_CLEAN:<br> - return 1;<br> case VOUT_CONTROL_CHANGE_FILTERS:<br> ThreadChangeFilters(vout, NULL,<br> cmd.string != NULL ?<br> @@ -1579,7 +1579,6 @@ static int ThreadControl(vout_thread_t *vout, <br> vout_control_cmd_t cmd)<br> break;<br> }<br> vout_control_cmd_Clean(&cmd);<br> - return 0;<br> }<br> <br> <br> /*****************************************************************************<br> @@ -1589,7 +1588,7 @@ static int ThreadControl(vout_thread_t *vout, <br> vout_control_cmd_t cmd)<br> * terminated. It handles the pictures arriving in the video heap and <br> the<br> * display device events.<br> <br> *****************************************************************************/<br> -static void *Thread(void *object)<br> +noreturn static void *Thread(void *object)<br> {<br> vout_thread_t *vout = object;<br> vout_thread_sys_t *sys = vout->p;<br> @@ -1607,20 +1606,21 @@ static void *Thread(void *object)<br> } else {<br> deadline = VLC_TICK_INVALID;<br> }<br> - while (!vout_control_Pop(&sys->control, &cmd, deadline))<br> - if (ThreadControl(vout, cmd))<br> - goto out;<br> + while (!vout_control_Pop(&sys->control, &cmd, deadline)) {<br> + int canc = vlc_savecancel();<br> + ThreadControl(vout, cmd);<br> + vlc_restorecancel(canc);<br> + }<br> <br> + int canc = vlc_savecancel();<br> deadline = VLC_TICK_INVALID;<br> wait = ThreadDisplayPicture(vout, &deadline) != VLC_SUCCESS;<br> <br> const bool picture_interlaced = sys->displayed.is_interlaced;<br> <br> vout_SetInterlacingState(vout, picture_interlaced);<br> + vlc_restorecancel(canc);<br> }<br> -<br> -out:<br> - return NULL;<br> }<br> <br> static void vout_StopDisplay(vout_thread_t *vout)<br> @@ -1628,7 +1628,7 @@ static void vout_StopDisplay(vout_thread_t *vout)<br> vout_thread_sys_t *sys = vout->p;<br> <br> assert(sys->original.i_chroma != 0);<br> - vout_control_PushVoid(&sys->control, VOUT_CONTROL_CLEAN);<br> + vlc_cancel(sys->thread);<br> vlc_join(sys->thread, NULL);<br> <br> if (sys->spu_blend != NULL)<hr> vlc-commits mailing list<br> vlc-commits@videolan.org<br> <a href="https://mailman.videolan.org/listinfo/vlc-commits">https://mailman.videolan.org/listinfo/vlc-commits</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>