13#ifndef ML_CLASSIC_HOST_H
14#define ML_CLASSIC_HOST_H
33class ProcessAllPagesHandler;
114 bool calledByProcessAllPages);
155 const std::vector <MLint> pageIDs,
WaitCondition _workAvailable
A wait condition to signal waiting worker threads that there is more work to be done.
WaitCondition _workDone
A wait condition that signals that all threads have done their work.
MLErrorCode _processPagesHelper(PagedImage &outputImage, const SubImageBox &location, MLDataType dataType, void *data, const ScaleShiftData &scaleShiftData, bool calledByProcessAllPages)
std::vector< ThreadDataClass ** > _workerThreadClassData
The offset into the current ThreadDataClass array; sorted by worker threads.
friend struct CalcPagesWorkerThreadFunction
Makes the worker thread function a friend.
static void _calcPagesMT(ThreadDataClass **threadDataContainers, ProcessingTimeLine::TimeLine *timeLine)
bool _useTimeLineProfiling
bool _shutdownWorkerThreadsFlag
Flag that signals that the worker threads should shutdown.
size_t _maxNumPagesToCalculateInSingleWorkerThread
The maximum number of pages that a single worker thread will calculate.
MLErrorCode getTile(PagedImage &outputImage, SubImageBox location, MLDataType dataType, void **data, const ScaleShiftData &scaleShiftData=ScaleShiftData())
ProcessingTimeLine & getProcessingTimeLine()
Returns access to the processing timeline.
void shutdownWorkerThreads()
Shuts down and frees all worker threads; all threads are joined when this method returns.
std::vector< Thread * > _workerThreads
The worker threads that are currently started.
MLint32 _errorCounter
Counter for errors detected in calcPagesMT, usually in different threads. Only valid during thread ca...
std::vector< ProcessingTimeLine::TimeLine * > _workerThreadTimeLines
Mutex _workAvailableMutex
Mutex that protects the work assignment to the worker threads.
MLErrorCode processAllPages(Module &module, MLint outputIndex, SubImageBox region, ProcessAllPagesHandler *handler)
Internal implementation of processAllPages functionality.
void _initializePageData(ThreadDataClass &tData, bool permitInCaching)
void _calcPages(PagedImage &outputImage, const std::vector< MLint > pageIDs, MLMemoryBlockHandle *memoryBlockHandles)
void enableTimeLineProfiling(bool flag)
Enables timeline profiling.
Host * _host
The core host.
MLint32 _numLaunchedThreads
Counter for the number of really launched threads. Only valid during thread calculations.
ThreadDataClass ** _getWorkForWorkerThread(size_t workIndex)
Returns the work for worker thread with workIndex.
MLint32 _numFinishedThreads
Counter for the number of already finished threads. Only valid during thread calculations.
ProcessingTimeLine _profile
ProcessingTimeLine::TimeLine * _guiTimeLine
void _increaseErrorCounter()
Increases the error counter (thread-safe).
MLErrorCode _getTileCore(PagedImage &outputImage, SubImageBox location, MLDataType dataType, void *data, const ScaleShiftData &scaleShiftData)
Timeline for a single thread.
Stores a processing timeline for multiple threads.
#define ML_DISALLOW_COPY_AND_ASSIGN(className)
Defines basic macros.
MLint32 MLErrorCode
Type of an ML Error code.
#define MLEXPORT
Code it as import symbol if compiled elsewhere.
TScaleShiftData< MLdouble > ScaleShiftData
Double version of TScaleShiftData for maximum reasonable precision.
TSubImageBox< MLint > SubImageBox
Defines the standard SubImageBox type used in the ML. Its size varies with the size of the MLint type...