Skip to content
Snippets Groups Projects

threads: use named variable for temporary cleanup to allow C++ calls in win32

Closed Steve Lhomme requested to merge robUx4/vlc:cpp-thread-cancel into master
1 unresolved thread
1 file
+ 2
9
Compare changes
  • Side-by-side
  • Inline
+ 2
9
@@ -1024,25 +1024,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 cancel_cleanup = { NULL, routine, arg }; \
vlc_control_cancel( &cancel_cleanup )
# define vlc_cleanup_pop( ) \
vlc_control_cancel (NULL); \
} while (0)
# else
# define vlc_cleanup_push(routine, arg) \
static_assert(false, "don't use vlc_cleanup_push in portable C++ code")
# define vlc_cleanup_pop() \
static_assert(false, "don't use vlc_cleanup_pop in portable C++ code")
# endif
#endif /* !LIBVLC_USE_PTHREAD_CLEANUP */
static inline void vlc_cleanup_lock (void *lock)
Loading