ATLAS Offline Software
stall.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
4  */
13 #ifndef CXXUTILS_STALL_H
14 #define CXXUTILS_STALL_H
15 
16 
17 #if defined(__i386__) || defined(__x86_64__)
18 # include <xmmintrin.h>
19 #endif
20 
21 
22 namespace CxxUtils {
23 
24 
36 inline
37 void stall()
38 {
39 #if defined(__i386__) || defined(__x86_64__)
40  _mm_pause();
41 #elif defined(__aarch64__) && defined(__GNUC__)
42  asm volatile("yield" ::: "memory");
43 #endif
44 }
45 
46 
47 } // namespace CxxUtils
48 
49 
50 #endif // not CXXUTILS_STALL_H
CxxUtils::stall
void stall()
Emit stall instruction for use in a spin loop.
Definition: stall.h:37
CxxUtils
Definition: aligned_vector.h:29