8#ifndef PXR_ARCH_THREADS_H
9#define PXR_ARCH_THREADS_H
14#include "pxr/arch/pxr.h"
15#include "pxr/arch/api.h"
20#ifdef ARCH_COMPILER_MSVC
26ARCH_NAMESPACE_OPEN_SCOPE
36#if defined(ARCH_CPU_INTEL)
37#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
38#define ARCH_SPIN_PAUSE() __builtin_ia32_pause()
39#elif defined(ARCH_COMPILER_MSVC)
40#define ARCH_SPIN_PAUSE() _mm_pause()
42#elif defined(ARCH_CPU_ARM)
43#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
44#define ARCH_SPIN_PAUSE() asm volatile ("yield" ::: "memory")
45#elif defined(ARCH_COMPILER_MSVC)
46#define ARCH_SPIN_PAUSE() __yield();
49#define ARCH_SPIN_PAUSE()
52ARCH_NAMESPACE_CLOSE_SCOPE
std::thread::id ArchGetMainThreadId()
Return the std::thread_id for the thread arch considers to be the "main" thread.
bool ArchIsMainThread()
Return true if the calling thread is the main thread, false otherwise.