GemaCoreLib
The GeMA Core library
Classes | Macros | Enumerations | Variables
gmThreadManager.h File Reference

Declaration of the GmThreadManager class. More...

#include "gmCoreConfig.h"
#include "gmLog.h"
#include <assert.h>
#include <QWaitCondition>
#include <QMutex>
#include <QQueue>
Include dependency graph for gmThreadManager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GmTLS< T, Align >
 A class that works together with GmThreadManager to provide thread local storage. More...
 
class  GmThreadTask
 Interface for a task executed by a thread manager thread. More...
 
class  GmThreadManager
 Thread manager used for handling parallel executions. More...
 
class  GmThread
 Our thread wrapper, specialized for running tasks from the thread manager queue. More...
 

Macros

#define GmThreadLocal   __thread
 Macro used to declare that a global / static variable has a per thread value (Thread Local Storage) More...
 

Enumerations

enum  GmThreadTaskResult { GM_THREAD_OK = 1, GM_THREAD_CANCELED = 2, GM_THREAD_ABORTED = 3 }
 Possible results for running a task. More...
 

Variables

GmThreadLocal int GmThreadManagerThreadId
 Local storage for thread ids. More efficient than using QThread::currentThread() for then accessing the thread id stored in the GmThread object. More...
 

Detailed Description

Declaration of the GmThreadManager class.

Author
Carlos Augusto Teixeira Mendes
Date
may, 2019

Macro Definition Documentation

◆ GmThreadLocal

#define GmThreadLocal   __thread

Macro used to declare that a global / static variable has a per thread value (Thread Local Storage)

IMPORTANT: The variable must be created BEFORE any thread criation. Space is not allocated for this variable in EXISTING threads (at least on Windows). This might be a problem if a thread local variable is declared in a DLL (plugin) loaded AFTER thread creation.

Enumeration Type Documentation

◆ GmThreadTaskResult

Possible results for running a task.

Enumerator
GM_THREAD_OK 

The thread finished its execution without errors.

GM_THREAD_CANCELED 

The thread was externally canceled.

GM_THREAD_ABORTED 

The thread aborted.

Variable Documentation

◆ GmThreadManagerThreadId

GmThreadLocal int GmThreadManagerThreadId

Local storage for thread ids. More efficient than using QThread::currentThread() for then accessing the thread id stored in the GmThread object.

Can not be a static member of GmThreadManager due to the GMC_API_EXPORT macro (thread variables can not have DLL interface).