aboutsummaryrefslogtreecommitdiffstats
path: root/vespamalloc
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-01-07 00:46:29 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-01-07 00:46:29 +0100
commit4e6b1987ae73852d0855b6e46e7cd36d8e6989fd (patch)
treeb6116441b0e65f69f0486240875c936ac0e7406b /vespamalloc
parentdf9289b224d4730341a8c6c9eceab62c41be360f (diff)
Simplify the for loop to a while loop since the old value is updated on failure.
Diffstat (limited to 'vespamalloc')
-rw-r--r--vespamalloc/src/vespamalloc/malloc/threadproxy.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/vespamalloc/src/vespamalloc/malloc/threadproxy.cpp b/vespamalloc/src/vespamalloc/malloc/threadproxy.cpp
index 7a071e87d41..193215ef83d 100644
--- a/vespamalloc/src/vespamalloc/malloc/threadproxy.cpp
+++ b/vespamalloc/src/vespamalloc/malloc/threadproxy.cpp
@@ -75,11 +75,11 @@ VESPA_DLL_EXPORT int local_pthread_create (pthread_t *thread,
void * (*start_routine) (void *),
void * arg)
{
- size_t numThreads;
- for (numThreads = _G_threadCount
- ;(numThreads < vespamalloc::_G_myMemP->getMaxNumThreads()) && ! _G_threadCount.compare_exchange_strong(numThreads, numThreads+1)
- ; numThreads = _G_threadCount) {
- }
+ size_t numThreads = _G_threadCount;
+ while ((numThreads < vespamalloc::_G_myMemP->getMaxNumThreads())
+ && ! _G_threadCount.compare_exchange_strong(numThreads, numThreads+1))
+ { }
+
if (numThreads >= vespamalloc::_G_myMemP->getMaxNumThreads()) {
return EAGAIN;
}