ATLAS Offline Software
Loading...
Searching...
No Matches
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 */
11
12
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
22namespace CxxUtils {
23
24
36inline
37void 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
void stall()
Emit stall instruction for use in a spin loop.
Definition stall.h:37