Skip to content

Commit

Permalink
Make TurnSequencer non-x86-safe
Browse files Browse the repository at this point in the history
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: [email protected]

Subscribers: folly-diffs@, yfeldblum, chalfant

FB internal diff: D2069320

Signature: t1:2069320:1431663264:3b3fb4282cf2b755f9b26c76b608b91ff665e226
  • Loading branch information
Delyan Kratunov authored and bugok committed Jun 3, 2015
1 parent 7a4c781 commit 8b9a09c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions folly/detail/TurnSequencer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <unistd.h>

#include <folly/detail/Futex.h>
#include <folly/Portability.h>

namespace folly {

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 8b9a09c

Please sign in to comment.