7#ifndef FMTTASK_Hm_included
8#define FMTTASK_Hm_included
11#include <boost/thread/recursive_mutex.hpp>
12#include <boost/thread/condition_variable.hpp>
57 virtual std::unique_ptr<FMTTask>
clone()
const;
64 virtual std::vector<std::unique_ptr<FMTTask>>
split(
const unsigned int& numberoftasks)
const;
70 virtual std::unique_ptr<FMTTask>
spawn();
133 std::vector<size_t>
_splitWork(
int numberoftasks,
const int& totalworksize)
const;
152 static size_t m_workingThreads;
155 static size_t m_allThreads;
158 static boost::condition_variable m_checkpoint;
161 static boost::mutex m_checkpointMutex;
#define FMTEXPORT
Definition: FMTutility.h:125
Base class of multiple FMT classes holding a shared exception handler pointer and logger.
Definition: FMTObject.h:49
RAII helper that installs a structured exception translator for its scope on MSVC.
Definition: FMTScopedSeTranslator.h:26
Task for parallel jobs.
Definition: FMTTask.h:27
std::unique_ptr< Logging::FMTLogger > m_tasklogger
Definition: FMTTask.h:120
virtual std::unique_ptr< FMTTask > spawn()
Spawn a minimal task from the master task.
void _decrementWorkingThread()
Decrement the number of working threads.
bool done
If the task is done true else false.
Definition: FMTTask.h:112
FMTTask()
Default constructor for FMTTask.
virtual bool SupportsMultiThreading() const
Check if the task support multithreading.
void _setCrashHandlers()
Set the terminate and abort handlers before running the global function in the thread,...
static std::string getThreadId()
Return true if the job is all done.
virtual ~FMTTask()=default
Default virtual destructor for FMTTask.
virtual std::unique_ptr< FMTTask > clone() const
Clone function for FMTTask.
static void setTotalThreads(const size_t &p_threads)
Set the total amount of threads.
void _checkpoint()
Wait for the other threads to finish their jobs, then continue.
virtual void finalize()
Called right after the last task is done, when overridden.
static boost::recursive_mutex m_taskmutex
Recursive mutex for the task.
Definition: FMTTask.h:116
virtual void work()
Main job executed by the thread.
virtual void run()
Set up the crash handler and call work.
virtual std::vector< std::unique_ptr< FMTTask > > split(const unsigned int &numberoftasks) const
Split the actual task into multiple tasks.
FMTTask(const FMTTask &rhs)
Default copy constructor for FMTTask.
std::vector< size_t > _splitWork(int numberoftasks, const int &totalworksize) const
Change the status of the task.
Namespace for parallel tasking may include multithreading / multiprocessing.
Definition: FMTOpAreaSchedulerTask.h:40