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
27PXR_NAMESPACE_OPEN_SCOPE
112#if defined(ARCH_CPU_INTEL)
113#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
114#define ARCH_SPIN_PAUSE() __builtin_ia32_pause()
115#elif defined(ARCH_COMPILER_MSVC)
116#define ARCH_SPIN_PAUSE() _mm_pause()
118#elif defined(ARCH_CPU_ARM)
119#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
120#define ARCH_SPIN_PAUSE() asm volatile ("yield" ::: "memory")
121#elif defined(ARCH_COMPILER_MSVC)
122#define ARCH_SPIN_PAUSE() __yield();
125#define ARCH_SPIN_PAUSE()
128PXR_NAMESPACE_CLOSE_SCOPE
ArchThreadPriority
Specifies a reduced-priority level for ArchSetThisThreadPriority().
@ ArchThreadPriorityLowest
Idle priority.
@ ArchThreadPriorityLow
Below-normal priority.
ARCH_API std::string ArchGetThisThreadName()
Return the name of the calling thread as a UTF-8 string, as previously set either by ArchSetThisThrea...
ARCH_API bool ArchSetThisThreadName(char const *name)
Set the name of the calling thread as UTF-8 text.
ARCH_API bool ArchSetThisThreadPriority(ArchThreadPriority priority)
Lower the priority of the calling thread to priority.
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.