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"),
11 * gpointer ("Pointer")
13 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
20 #include <mono/utils/mono-compiler.h>
22 #if MONO_HAS_CLANG_THREAD_SANITIZER
23 #define MONO_UNLOCKED_ATTRS MONO_NO_SANITIZE_THREAD MONO_NEVER_INLINE static
24 #elif defined(_MSC_VER)
25 #define MONO_UNLOCKED_ATTRS MONO_ALWAYS_INLINE static
27 #define MONO_UNLOCKED_ATTRS MONO_ALWAYS_INLINE static inline
32 UnlockedIncrement (volatile gint32
*val
)
39 UnlockedIncrement64 (volatile gint64
*val
)
46 UnlockedDecrement64 (volatile gint64
*val
)
53 UnlockedDecrement (volatile gint32
*val
)
60 UnlockedAdd (volatile gint32
*dest
, gint32 add
)
67 UnlockedAdd64 (volatile gint64
*dest
, gint64 add
)
74 UnlockedAddDouble (volatile gdouble
*dest
, gdouble add
)
81 UnlockedSubtract64 (volatile gint64
*dest
, gint64 sub
)
88 UnlockedWrite (volatile gint32
*dest
, gint32 val
)
95 UnlockedWrite64 (volatile gint64
*dest
, gint64 val
)
102 UnlockedWriteBool (volatile gboolean
*dest
, gboolean val
)
109 UnlockedWritePointer (volatile gpointer
*dest
, gpointer val
)
116 UnlockedRead (volatile gint32
*src
)
123 UnlockedRead64 (volatile gint64
*src
)
130 UnlockedReadBool (volatile gboolean
*src
)
137 UnlockedReadPointer (volatile gpointer
*src
)
142 #endif /* _UNLOCKED_H_ */