From: Delyan Kratunov Date: Fri, 29 May 2015 00:31:09 +0000 (-0700) Subject: Make TurnSequencer non-x86-safe X-Git-Tag: v0.42.0~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8b9a09ce4320290b698f5a7804f25548ca85d10f;p=folly.git Make TurnSequencer non-x86-safe Summary: `TurnSequencer` uses inline assembly, which obviously won't work on ARM. Guard said assembly to x86{,_64} targets. Test Plan: Added an always-false `static_assert` to the `ifdef` block, confirmed it gets triggered (i.e., we're not removing the `pause` on x86_64). Reviewed By: ngbronson@fb.com Subscribers: folly-diffs@, yfeldblum, chalfant FB internal diff: D2069320 Signature: t1:2069320:1431663264:3b3fb4282cf2b755f9b26c76b608b91ff665e226 --- diff --git a/folly/detail/TurnSequencer.h b/folly/detail/TurnSequencer.h index 42bb7d01..9fdb5b1d 100644 --- a/folly/detail/TurnSequencer.h +++ b/folly/detail/TurnSequencer.h @@ -22,6 +22,7 @@ #include #include +#include namespace folly { @@ -123,7 +124,9 @@ struct TurnSequencer { // the first effectSpinCutoff tries are spins, after that we will // record ourself as a waiter and block with futexWait if (tries < effectiveSpinCutoff) { +#if defined(__i386__) || FOLLY_X64 asm volatile ("pause"); +#endif continue; }