Skip to content

internal: Move shims include so DISPATCH_INTERNAL_CRASH is defined #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/shims/lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,17 @@ _dispatch_once_xchg_done(dispatch_once_t *pred)
return os_atomic_xchg(pred, DLOCK_ONCE_DONE, release);
#elif defined(__linux__)
if (unlikely(syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0) < 0)) {
DISPATCH_INTERNAL_CRASH(errno, "sys_membarrier not supported");
/*
* sys_membarrier not supported
*
* Ideally we would call DISPATCH_INTERNAL_CRASH() here, but
* due to ordering constraints in internal.h required by Darwin
* the macro is undefined when this header is included.
* Instead, open-code what would be a call to
* _dispatch_hardware_crash() inside DISPATCH_INTERNAL_CRASH().
*/
__asm__("");
__builtin_trap();
}
return os_atomic_xchg(pred, DLOCK_ONCE_DONE, relaxed);
#else
Expand Down