<html><head></head><body>It's a problem of the site of the cancellation point not to have C++ frames in need of unwinding. Thus pushing cleanup handler in C++ is useless, AFAICT.<br><br>Except on GNU/Linux which defines cancellation in C++ code.<br><br><div class="gmail_quote">Le 10 février 2020 17:06:38 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> 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">On 2020-02-10 15:53, 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;">Hi,<br><br>This is missing unwinding code for C++. The removed comments are there <br>for reasons...<br></blockquote><br>Isn't that a problem of the routine called, rather than storing the <br>routine ? In that case we may impose some restrictions on the routine <br>(via strong typing).<br><br>It seems throwing an exception in the routine might be a good way to do <br>things cleanly.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le 10 février 2020 15:55:44 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a <br>écrit :<br><br> Should fix #23591<hr> include/vlc_threads.h | 12 ++----------<br> 1 file changed, 2 insertions(+), 10 deletions(-)<br><br> diff --git a/include/vlc_threads.h b/include/vlc_threads.h<br> index 0e27ea803fa..b2ef5222d3b 100644<br> --- a/include/vlc_threads.h<br> +++ b/include/vlc_threads.h<br> @@ -1071,26 +1071,18 @@ struct vlc_cleanup_t<br> void *data;<br> };<br> <br> -# ifndef __cplusplus<br> /* This macros opens a code block on purpose: It reduces the chance of<br> * not pairing the push and pop. It also matches the POSIX Thread internals.<br> * That way, Win32 developers will not accidentally break other platforms.<br> */<br> # define vlc_cleanup_push( routine, arg ) \<br> do { \<br> - vlc_control_cancel(&(vlc_cleanup_t){ NULL, routine, arg })<br> + vlc_cleanup_t _cleanup = (vlc_cleanup_t){ NULL, routine, arg }; \<br> + vlc_control_cancel(&_cleanup)<br> <br> # define vlc_cleanup_pop( ) \<br> vlc_control_cancel (NULL); \<br> } while (0)<br> -# else<br> -/* Those macros do not work in C++. However common C/C++ helpers may call them<br> - * anyway - this is fine if the code is never cancelled in C++ case.<br> - * So define the macros to do nothing.<br> - */<br> -# define vlc_cleanup_push(routine, arg) do { (routine, arg)<br> -# define vlc_cleanup_pop() } while (0)<br> -# endif<br> <br> #endif /* !LIBVLC_USE_PTHREAD_CLEANUP */<br> <br><br><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser <br>ma brièveté.<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><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>