Skip to content

Commit

Permalink
Use asm instead of _mm_pause for non-SSE CPUs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ymmt2005 committed Jan 17, 2014
1 parent efd6021 commit 7a0b4f6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cybozu/spinlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ class spinlock {
std::atomic_flag m_flag;
void pause() {
#if defined(__i386__) || defined(__x86_64__)
# if defined(__SSE__)
_mm_pause();
# else
__asm__ __volatile__ ("rep; nop");
# endif
#endif
}
};
Expand Down

0 comments on commit 7a0b4f6

Please sign in to comment.