3 * Contains inline functions to explicitly mark data races that should not be changed.
4 * This way, instruments like Clang's ThreadSanitizer can be told to ignore very specific instructions.
6 * Please keep this file and its methods organised:
7 * * Increment, Decrement, Add, Subtract, Write, Read
8 * * gint32 (""), guint32 ("Unsigned"),
9 * gint64 ("64"), guint64 ("Unsigned64"),
10 * gsize ("Size"), gboolean ("Bool")
12 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
19 #include <mono/utils/mono-compiler.h>
21 #if MONO_HAS_CLANG_THREAD_SANITIZER
22 #define MONO_UNLOCKED_ATTRS MONO_NO_SANITIZE_THREAD MONO_NEVER_INLINE static
23 #elif defined(_MSC_VER)
24 #define MONO_UNLOCKED_ATTRS MONO_ALWAYS_INLINE static
26 #define MONO_UNLOCKED_ATTRS MONO_ALWAYS_INLINE static inline
31 UnlockedIncrement (gint32 *val)
38 UnlockedIncrement64 (gint64 *val)
45 UnlockedDecrement64 (gint64 *val)
52 UnlockedDecrement (gint32 *val)
59 UnlockedAdd (gint32 *dest, gint32 add)
66 UnlockedAdd64 (gint64 *dest, gint64 add)
73 UnlockedAddDouble (gdouble *dest, gdouble add)
80 UnlockedSubtract64 (gint64 *dest, gint64 sub)
87 UnlockedWrite (gint32 *dest, gint32 val)
94 UnlockedWrite64 (gint64 *dest, gint64 val)
101 UnlockedWriteBool (gboolean *dest, gboolean val)
108 UnlockedRead (gint32 *src)
115 UnlockedRead64 (gint64 *src)
122 UnlockedReadBool (gboolean *src)
129 UnlockedReadPointer (volatile gpointer *src)
134 #endif /* _UNLOCKED_H_ */