24#ifndef PXR_BASE_ARCH_THREADS_H
25#define PXR_BASE_ARCH_THREADS_H
32#include "pxr/base/arch/api.h"
33#include "pxr/base/arch/defines.h"
37#ifdef ARCH_COMPILER_MSVC
43PXR_NAMESPACE_OPEN_SCOPE
54#if defined(ARCH_CPU_INTEL)
55#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
56#define ARCH_SPIN_PAUSE() __builtin_ia32_pause()
57#elif defined(ARCH_COMPILER_MSVC)
58#define ARCH_SPIN_PAUSE() _mm_pause()
60#elif defined(ARCH_CPU_ARM)
61#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
62#define ARCH_SPIN_PAUSE() asm volatile ("yield" ::: "memory")
63#elif defined(ARCH_COMPILER_MSVC)
64#define ARCH_SPIN_PAUSE() __yield();
67#define ARCH_SPIN_PAUSE()
70PXR_NAMESPACE_CLOSE_SCOPE
ARCH_API std::thread::id ArchGetMainThreadId()
Return the std::thread_id for the thread arch considers to be the "main" thread.
ARCH_API bool ArchIsMainThread()
Return true if the calling thread is the main thread, false otherwise.