[vlc-commits] threads: make vlc_cleanup_push call the cleanup function in C++ on Win32/OS2
Steve Lhomme
git at videolan.org
Tue Feb 11 08:14:26 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 10 14:53:34 2020 +0100| [c0f979c95d91fb36a2ae0805bbc2d4a1844fa11b] | committer: Steve Lhomme
threads: make vlc_cleanup_push call the cleanup function in C++ on Win32/OS2
Should fix #23591
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c0f979c95d91fb36a2ae0805bbc2d4a1844fa11b
---
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 0e27ea803f..b2ef5222d3 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 */
More information about the vlc-commits
mailing list