/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const int max = 1000;
unsigned int seed = (uintptr_t)pthread_self();
for (int i = 0; i < max; i++) {
- asm("pause");
+ folly::asm_pause();
SpinLockGuardImpl<LOCK> g(v->lock);
int first = v->ar[0];
template <typename LOCK>
void trylockTestThread(TryLockState<LOCK>* state, size_t count) {
while (true) {
- asm("pause");
+ folly::asm_pause();
SpinLockGuardImpl<LOCK> g(state->lock1);
if (state->obtained >= count) {
break;
auto oldFailed = state->failed;
while (state->failed == oldFailed && state->obtained < count) {
state->lock1.unlock();
- asm("pause");
+ folly::asm_pause();
state->lock1.lock();
}
}
#endif
-#if !__ANDROID__
+#if FOLLY_HAVE_PTHREAD_SPINLOCK_T
TEST(SpinLock, PthreadCorrectness) {
correctnessTest<folly::SpinLockPthreadImpl>();
}