Skip to content

Commit

Permalink
Fix WatchOS simulator not supporting thread_local (#5341)
Browse files Browse the repository at this point in the history
* Add conditional for architecture ARM64 and i386 on WatchOS for `thread_local`

* Use the correct check for if thread-local storage is supported

Co-authored-by: Thomas Goyne <[email protected]>
  • Loading branch information
dianaafanador3 and tgoyne authored Jul 6, 2022
1 parent e2e706a commit a1907d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Fix exception when decoding interned strings in realm-apply-to-state tool. ([#5628](https://github.com/realm/realm-core/pull/5628))
* Fix some warnings when building with Xcode 14 ([PR #5577](https://github.com/realm/realm-core/pull/5577)).
* Throw `runtime_error` if subscription set is requested and flexible sync is not enabled. ([#5637](https://github.com/realm/realm-core/pull/5637))
* Fix compilation failures on watchOS platforms which do not support thread-local storage. ([#7694](https://github.com/realm/realm-swift/issues/7694), [#7695](https://github.com/realm/realm-swift/issues/7695) since v11.7.0)

### Breaking changes
* None.
Expand Down
9 changes: 4 additions & 5 deletions src/realm/impl/simulated_failure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ bool SimulatedFailure::do_check_trigger(FailureType failure_type) noexcept
return false;
}

#if (REALM_ARCHITECTURE_X86_32 && REALM_IOS) || (REALM_ARCHITECTURE_X86_64 && REALM_WATCHOS)
bool (*s_mmap_predicate)(size_t);
#else
thread_local bool (*s_mmap_predicate)(size_t);
#endif // REALM_ARCHITECTURE_X86_32 && REALM_IOS
#if !defined(__clang__) || REALM_HAVE_CLANG_FEATURE(cxx_thread_local)
thread_local
#endif
bool (*s_mmap_predicate)(size_t);

void SimulatedFailure::do_prime_mmap(bool (*predicate)(size_t))
{
Expand Down

0 comments on commit a1907d6

Please sign in to comment.