diff --git a/pxr/base/work/threadLimits.cpp b/pxr/base/work/threadLimits.cpp index a1fafdd64d..7e02263a1e 100644 --- a/pxr/base/work/threadLimits.cpp +++ b/pxr/base/work/threadLimits.cpp @@ -85,8 +85,8 @@ Work_NormalizeThreadCount(const int n) // Returns the normalized thread limit value from the environment setting. Note // that 0 means "no change", i.e. the environment setting does not apply. -static unsigned -Work_GetConcurrencyLimitSetting() +unsigned +WorkGetConcurrencyLimitEnvSetting() { return Work_NormalizeThreadCount(TfGetEnvSetting(PXR_WORK_THREAD_LIMIT)); } @@ -106,7 +106,7 @@ Work_InitializeThreading() { // Get the thread limit from the environment setting. Note that this value // can be 0, i.e. the environment setting does not apply. - const unsigned settingVal = Work_GetConcurrencyLimitSetting(); + const unsigned settingVal = WorkGetConcurrencyLimitEnvSetting(); // Threading is initialized with maximum physical concurrency. const unsigned physicalLimit = WorkGetPhysicalConcurrencyLimit(); @@ -147,7 +147,7 @@ WorkSetConcurrencyLimit(unsigned n) if (n) { // Get the thread limit from the environment setting. Note this value // may be 0 (default). - const unsigned settingVal = Work_GetConcurrencyLimitSetting(); + const unsigned settingVal = WorkGetConcurrencyLimitEnvSetting(); // Override n with the environment setting. This will make sure that the // setting always wins over the specified value n, but only if the diff --git a/pxr/base/work/threadLimits.h b/pxr/base/work/threadLimits.h index 11bd658c0c..59ef9f1c45 100644 --- a/pxr/base/work/threadLimits.h +++ b/pxr/base/work/threadLimits.h @@ -30,6 +30,13 @@ PXR_NAMESPACE_OPEN_SCOPE /// WORK_API unsigned WorkGetConcurrencyLimit(); +/// Return the value set via the PXR_WORK_THREAD_LIMIT env setting. +/// +/// The returned value is always >= 0, and it is normalized according to the +/// rules in WorkSetConcurrencyLimitArgument. +/// +WORK_API unsigned WorkGetConcurrencyLimitEnvSetting(); + /// Return true if WorkGetPhysicalConcurrencyLimit() returns a number greater /// than 1 and PXR_WORK_THREAD_LIMIT was not set in an attempt to limit the /// process to a single thread, false otherwise.