Michaël Lemaire
14fcc1883e
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@483 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
30 lines
756 B
C
30 lines
756 B
C
#ifndef _PAYSAGES_TOOLS_PARALLEL_H_
|
|
#define _PAYSAGES_TOOLS_PARALLEL_H_
|
|
|
|
/*
|
|
* Parallel processing helpers.
|
|
*
|
|
* Several units of work can be accomplished by a given number of parallel workers.
|
|
* Workers are implemented by threads so thread-safety must be ensured while accessing
|
|
* shared data from unit functions.
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct ParallelWork ParallelWork;
|
|
typedef int (*ParallelUnitFunction)(ParallelWork* work, int unit, void* data);
|
|
|
|
/*void parallelInit();
|
|
void parallelQuit();*/
|
|
|
|
ParallelWork* parallelWorkCreate(ParallelUnitFunction func, int units, void* data);
|
|
void parallelWorkDelete(ParallelWork* work);
|
|
int parallelWorkPerform(ParallelWork* work, int workers);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|