-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono] Second try at using C11 atomics (#91808)
* For each platform decide if we will use C11 standard atomics, Win32 API atomics, GCC atomic intrinsics or emulated atomics. To use C11 atomics we generally want them to be lock-free for the primitive types we care about (that is, `ATOMIC_LONG_LONG_LOCK_FREE == 2` not `1` and similarly for other macros) because otherwise we cannot be sure if the atomic might use a global lock in which case we could have thread suspend problems if both the GC and the rest of the runtime use an atomic at the same time. * On win32, use the win32 atomics until MSVC atomics support is not experimental, or we update our build to pass `/experimental:c11atomics`; and also until we build our C++ code with C++23 or later (otherwise MSVC will complain about including stdatomic.h) * If the header gets included while we're generating offsets using `offsets-tool.py`, pretend we're using emulated atomics. On some Linux configurations, the libclang that we use ends up picking up the platform `atomic.h` header, not the clang one, and then errors out on their underlying implementation. * Replace the use of `bool` in some macros in Mono - it will expand to `_Bool` in C11 and mess things up. Use `boolean` instead Fixes #91779
- Loading branch information
1 parent
e2c319a
commit c48aa81
Showing
5 changed files
with
291 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters