aboutsummaryrefslogtreecommitdiffstats
path: root/vespamalloc/src/vespamalloc/malloc/threadlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'vespamalloc/src/vespamalloc/malloc/threadlist.h')
-rw-r--r--vespamalloc/src/vespamalloc/malloc/threadlist.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/vespamalloc/src/vespamalloc/malloc/threadlist.h b/vespamalloc/src/vespamalloc/malloc/threadlist.h
index 149396a3bff..95ff072d035 100644
--- a/vespamalloc/src/vespamalloc/malloc/threadlist.h
+++ b/vespamalloc/src/vespamalloc/malloc/threadlist.h
@@ -27,22 +27,17 @@ public:
ThreadPool & getCurrent() { return *_myPool; }
size_t getThreadId() const { return (_myPool - _threadVector); }
void enableThreadSupport() {
- if ( ! _isThreaded ) {
- _isThreaded = true;
- }
+ _isThreaded.test_and_set();
}
void info(FILE * os, size_t level=0);
size_t getMaxNumThreads() const { return NELEMS(_threadVector); }
private:
- size_t getThreadCount() const { return _threadCount; }
- size_t getThreadCountAccum() const { return _threadCountAccum; }
ThreadListT(const ThreadListT & tl);
ThreadListT & operator = (const ThreadListT & tl);
- enum {ThreadStackSize=2048*1024};
- volatile bool _isThreaded;
- std::atomic<size_t> _threadCount;
- std::atomic<size_t> _threadCountAccum;
+ std::atomic_flag _isThreaded;
+ std::atomic<uint32_t> _threadCount;
+ std::atomic<uint32_t> _threadCountAccum;
ThreadPool _threadVector[NUM_THREADS];
AllocPoolT<MemBlockPtrT> & _allocPool;
static thread_local ThreadPool * _myPool TLS_LINKAGE;