[vlc-devel] [PATCH] threads: make vlc_cleanup_push call the cleanup function in C++ on Win32/OS2

Rémi Denis-Courmont remi at remlab.net
Mon Feb 10 15:53:11 CET 2020


Hi,

This is missing unwinding code for C++. The removed comments are there for reasons...

Le 10 février 2020 15:55:44 GMT+02:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>Should fix #23591
>---
> include/vlc_threads.h | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
>diff --git a/include/vlc_threads.h b/include/vlc_threads.h
>index 0e27ea803fa..b2ef5222d3b 100644
>--- a/include/vlc_threads.h
>+++ b/include/vlc_threads.h
>@@ -1071,26 +1071,18 @@ struct vlc_cleanup_t
>     void          *data;
> };
> 
>-# ifndef __cplusplus
> /* This macros opens a code block on purpose: It reduces the chance of
>* not pairing the push and pop. It also matches the POSIX Thread
>internals.
>* That way, Win32 developers will not accidentally break other
>platforms.
>  */
> # define vlc_cleanup_push( routine, arg ) \
>     do { \
>-        vlc_control_cancel(&(vlc_cleanup_t){ NULL, routine, arg })
>+        vlc_cleanup_t _cleanup = (vlc_cleanup_t){ NULL, routine, arg
>}; \
>+        vlc_control_cancel(&_cleanup)
> 
> #  define vlc_cleanup_pop( ) \
>         vlc_control_cancel (NULL); \
>     } while (0)
>-# else
>-/* Those macros do not work in C++. However common C/C++ helpers may
>call them
>- * anyway - this is fine if the code is never cancelled in C++ case.
>- * So define the macros to do nothing.
>- */
>-#  define vlc_cleanup_push(routine, arg) do { (routine, arg)
>-#  define vlc_cleanup_pop() } while (0)
>-# endif
> 
> #endif /* !LIBVLC_USE_PTHREAD_CLEANUP */
> 
>-- 
>2.17.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200210/c87562f8/attachment.html>


More information about the vlc-devel mailing list