Internals: Add attribute when using clang to VL_MT_SAFE and VL_MT_UNSAFE (#3685)

This commit is contained in:
Kamil Rakoczy 2022-10-18 11:15:33 +02:00 committed by GitHub
parent c057847760
commit 54e3f15dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,14 +163,22 @@
// Comment tag that Function is pure (and thus also VL_MT_SAFE)
#define VL_PURE
// Comment tag that function is threadsafe when VL_THREADED
#define VL_MT_SAFE
#if defined(__clang__)
# define VL_MT_SAFE __attribute__((annotate("MT_SAFE")))
#else
# define VL_MT_SAFE
#endif
// Comment tag that function is threadsafe when VL_THREADED, only
// during normal operation (post-init)
#define VL_MT_SAFE_POSTINIT
// Attribute that function is clang threadsafe and uses given mutex
#define VL_MT_SAFE_EXCLUDES(mutex) VL_EXCLUDES(mutex)
// Comment tag that function is not threadsafe when VL_THREADED
#define VL_MT_UNSAFE
#if defined(__clang__)
# define VL_MT_UNSAFE __attribute__((annotate("MT_UNSAFE")))
#else
# define VL_MT_UNSAFE
#endif
// Comment tag that function is not threadsafe when VL_THREADED,
// protected to make sure single-caller
#define VL_MT_UNSAFE_ONE