55 pthread_mutex_t mutex;
210 virtual void run() = 0;
256 void createThreads();
262 void setData(
void * data,
int nThread = -1);
398 void setBlockSize(
size_t bSize);
401 int getBlockSize()
const;
427 bool getTasks(
size_t &
first,
size_t &last);
433 bool setAssignedTasks(
size_t tasks);
440 virtual void lock() = 0;
441 virtual void unlock() = 0;
442 virtual bool distribute(
size_t &first,
size_t &last) = 0;
463 virtual bool distribute(
size_t &
first,
size_t &last);
465 virtual void reset() { setAssignedTasks(0); };
int barrier_init(barrier_t *barrier, int needed)
void * _threadMain(void *data)
virtual ~ThreadTaskDistributor()
int threads
number of working threads.
int called
How many threads already arrived.
int barrier_destroy(barrier_t *barrier)
void * _singleThreadMain(void *data)
void(* ThreadFunction)(ThreadArgument &arg)
int threads
Number of threads.
int needed
How many threads should be awaited.
void * workClass
The class in which threads will be working.
pthread_cond_t cond
Condition on which the threads are waiting.
Mutex mutex
Mutex to synchronize access to critical region.
ThreadTaskDistributor(size_t nTasks, size_t bSize)
virtual ~ParallelTaskDistributor()
pthread_mutex_t mutex
Mutex to update this structure.
int thread_id
The thread id.
int barrier_wait(barrier_t *barrier)
struct mybarrier_t barrier_t