wxMaxima
Loading...
Searching...
No Matches
Public Member Functions
ThreadNumberLimiter Class Reference

Waits until more cores are available than threads are running. More...

#include <ThreadNumberLimiter.h>

Public Member Functions

 ThreadNumberLimiter ()
 Increments m_numberOfBackgroundThreads and blocks, until this number lowers again.
 
virtual ~ThreadNumberLimiter ()
 Decrements m_numberOfBackgroundThreads and waits.
 

Detailed Description

Waits until more cores are available than threads are running.

How it works:

Each thread that tries to avoid running more threads than there are CPUs available creates variable of the type ThreadNumberLimiter. This ThreadNumberLimiter at start-up increases m_numberOfBackgroundThreads and waits until that number is low enough- When the block the variable was instantiated in ends m_numberOfBackgroundThreads is decremented, again.


The documentation for this class was generated from the following files: