7#ifndef PXR_BASE_ARCH_THREADS_H
8#define PXR_BASE_ARCH_THREADS_H
15#include "pxr/base/arch/api.h"
16#include "pxr/base/arch/defines.h"
20#ifdef ARCH_COMPILER_MSVC
26PXR_NAMESPACE_OPEN_SCOPE
37#if defined(ARCH_CPU_INTEL)
38#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
39#define ARCH_SPIN_PAUSE() __builtin_ia32_pause()
40#elif defined(ARCH_COMPILER_MSVC)
41#define ARCH_SPIN_PAUSE() _mm_pause()
43#elif defined(ARCH_CPU_ARM)
44#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
45#define ARCH_SPIN_PAUSE() asm volatile ("yield" ::: "memory")
46#elif defined(ARCH_COMPILER_MSVC)
47#define ARCH_SPIN_PAUSE() __yield();
50#define ARCH_SPIN_PAUSE()
53PXR_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.