Skip to content

Commit

Permalink
Bug 1758780 - Fallthrough to <atomic> for wasi when using clang >= 14…
Browse files Browse the repository at this point in the history
…. r=nika

Clang 14 added a dummy backoff policy for atomic polling that doesn't
know about threads, which presumably WASI can use.
See https://reviews.llvm.org/D114109.

Differential Revision: https://phabricator.services.mozilla.com/D143173
  • Loading branch information
glandium committed Apr 13, 2022
1 parent 752b35b commit c8251f9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mfbt/WasiAtomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
#ifndef mozilla_WasiAtomic_h
#define mozilla_WasiAtomic_h

#include <cstdint>
// Clang >= 14 supports <atomic> for wasm targets.
#if _LIBCPP_VERSION >= 14000
# include <atomic>
#else

# include <cstdint>

// WASI doesn't support <atomic> and we use it as single-threaded for now.
// This is a stub implementation of std atomics to build WASI port of SM.
Expand Down Expand Up @@ -189,4 +194,6 @@ using atomic_uint64_t = atomic<uint64_t>;

} // namespace std

#endif

#endif // mozilla_WasiAtomic_h

0 comments on commit c8251f9

Please sign in to comment.