Geogram  Version 1.9.0
A programming library of geometric algorithms
GEO::MonoThreadingThreadManager Class Reference

Single thread ThreadManager. More...

#include <geogram/basic/process.h>

Inheritance diagram for GEO::MonoThreadingThreadManager:
GEO::ThreadManager GEO::Counted

Public Member Functions

index_t maximum_concurrent_threads () override
 Gets the maximum number of possible concurrent threads. More...
 
- Public Member Functions inherited from GEO::ThreadManager
virtual void run_threads (ThreadGroup &threads)
 Runs a group of Threads. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Protected Member Functions

 ~MonoThreadingThreadManager () override
 
void run_concurrent_threads (ThreadGroup &threads, index_t max_threads) override
 Runs a group of Threads concurrently. More...
 
- Protected Member Functions inherited from GEO::ThreadManager
 ~ThreadManager () override
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Static Protected Member Functions inherited from GEO::ThreadManager
static void set_thread_id (Thread *thread, index_t id)
 Sets the id of a thread. More...
 
static void set_current_thread (Thread *thread)
 Specifies the current instance, used by current(). More...
 

Detailed Description

Single thread ThreadManager.

MonoThreadingThreadManager implements a ThreadManager for single thread environments.

Definition at line 297 of file process.h.

Constructor & Destructor Documentation

◆ ~MonoThreadingThreadManager()

GEO::MonoThreadingThreadManager::~MonoThreadingThreadManager ( )
overrideprotected

Member Function Documentation

◆ maximum_concurrent_threads()

index_t GEO::MonoThreadingThreadManager::maximum_concurrent_threads ( )
overridevirtual

Gets the maximum number of possible concurrent threads.

Returns
The maximum number of possible concurrent threads allowed by this manager. It depends on the physical number of cores (including hyper-threading or not) and the technology implemented by this manager.
See also
Process::number_of_cores()
Note
This implementation always returns 1.

Implements GEO::ThreadManager.

◆ run_concurrent_threads()

void GEO::MonoThreadingThreadManager::run_concurrent_threads ( ThreadGroup threads,
index_t  max_threads 
)
overrideprotectedvirtual

Runs a group of Threads concurrently.

This start the concurrent execution of the threads contained in vector threads, using the given number of threads max_threads. The execution terminates when the last thread terminates.

Parameters
[in]threadsthe vector of threads to be executed.
[in]max_threadsmaximum number of threads allowed for this execution. It is always greater than one
Note
This implementation always executes threads sequentially.

Implements GEO::ThreadManager.


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