Task Scheduler  3d2d7233
Core functions

Functions

TASH_SCH_EXTERN int schAllocateTaskPool (schTaskSch **pSch)
 Allocate task scheduler object. It will make sure that for any version of the library, that the size of the internal structure are of correct size. More...
 
TASH_SCH_EXTERN int schCreateTaskPool (schTaskSch *sch, int cores, unsigned int flag, unsigned int maxPackagesPool)
 Initilize task scheduler internal data structure. More...
 
TASH_SCH_EXTERN int schReleaseTaskSch (schTaskSch *sch)
 Release all resources associated with the scheduler object. More...
 
TASH_SCH_EXTERN void schSetInitCallBack (schTaskSch *sch, schUserCallBack callBack)
 Set initialization callback that will be invoked when the scheduler starts. More...
 
TASH_SCH_EXTERN void schSetDeInitCallBack (schTaskSch *sch, schUserCallBack callBack)
 Set user deinitialize callback that will be invoked when the scheduler gets terminated. More...
 
TASH_SCH_EXTERN void schSetSchUserData (schTaskSch *sch, const void *user)
 Assign user data associated with the scheduler object. More...
 
TASH_SCH_EXTERN void schSetPoolUserData (schTaskSch *sch, int index, const void *user)
 Assign user data associated with the scheduler objects pools. More...
 
TASH_SCH_EXTERN void * schGetPoolUserData (schTaskSch *sch, int index)
 Get pool user data. More...
 
TASH_SCH_EXTERN schTaskPoolschGetPool (schTaskSch *sch, int index)
 Get scheduler pool by index. More...
 

Detailed Description

Info

Example code for how to create, start, submit task, finally release the task internal resources.

...
Your code.
...

Function Documentation

◆ schAllocateTaskPool()

TASH_SCH_EXTERN int schAllocateTaskPool ( schTaskSch **  pSch)

Allocate task scheduler object. It will make sure that for any version of the library, that the size of the internal structure are of correct size.

Since
0.2.0
Parameters
pSchvalid pointer object.
Returns
non-negative if successfully.

◆ schCreateTaskPool()

TASH_SCH_EXTERN int schCreateTaskPool ( schTaskSch sch,
int  cores,
unsigned int  flag,
unsigned int  maxPackagesPool 
)

Initilize task scheduler internal data structure.

See also
schAllocateTaskPool for how to create and allocate schTaskSch object.
Parameters
schobject reference.
coresnumber of pool that will be allocated. -1 will select number of pools that matches the number of cores.
flagproperties.
maxPackagesPoolSets the max number of task on each pool can have in the queue at any given moment.
Returns
non-negative if successfully released.
Since
0.1.0

◆ schReleaseTaskSch()

TASH_SCH_EXTERN int schReleaseTaskSch ( schTaskSch sch)

Release all resources associated with the scheduler object.

Parameters
schscheduler object.
Returns
non-negative if successfully released.
Since
0.1.0

◆ schSetInitCallBack()

TASH_SCH_EXTERN void schSetInitCallBack ( schTaskSch sch,
schUserCallBack  callBack 
)

Set initialization callback that will be invoked when the scheduler starts.

Parameters
schscheduler object.
callBacknon-null function pointer.
Since
0.1.0

◆ schSetDeInitCallBack()

TASH_SCH_EXTERN void schSetDeInitCallBack ( schTaskSch sch,
schUserCallBack  callBack 
)

Set user deinitialize callback that will be invoked when the scheduler gets terminated.

Since
0.1.0
Parameters
schscheduler object.
callBacknon-null function pointer.

◆ schSetSchUserData()

TASH_SCH_EXTERN void schSetSchUserData ( schTaskSch sch,
const void *  user 
)

Assign user data associated with the scheduler object.

Since
0.1.0
Parameters
schvalid scheduler object.
uservalid pointer.

◆ schSetPoolUserData()

TASH_SCH_EXTERN void schSetPoolUserData ( schTaskSch sch,
int  index,
const void *  user 
)

Assign user data associated with the scheduler objects pools.

Parameters
schvalid scheduler object.
indexvalid pool index, where \( index \in [0, nrPools -1] \).
uservalid pointer.
See also
schGetPoolUserData

◆ schGetPoolUserData()

TASH_SCH_EXTERN void* schGetPoolUserData ( schTaskSch sch,
int  index 
)

Get pool user data.

Since
0.1.0
Parameters
schschedule object.
indexvalid pool index, where \( index \in [0, nrPools -1] \).
Returns
non-null pointer if user pointer exists, NULL otherwise.
See also
schSetPoolUserData

◆ schGetPool()

TASH_SCH_EXTERN schTaskPool* schGetPool ( schTaskSch sch,
int  index 
)

Get scheduler pool by index.

Since
0.1.0
Parameters
sch
index
Returns
non-null if the index is valid.
schReleaseTaskSch
TASH_SCH_EXTERN int schReleaseTaskSch(schTaskSch *sch)
Release all resources associated with the scheduler object.
schAllocateTaskPool
TASH_SCH_EXTERN int schAllocateTaskPool(schTaskSch **pSch)
Allocate task scheduler object. It will make sure that for any version of the library,...
sch_task_scheduler_t
Task scheduler main struct container.
Definition: internal_structures.h:75
schCreateTaskPool
TASH_SCH_EXTERN int schCreateTaskPool(schTaskSch *sch, int cores, unsigned int flag, unsigned int maxPackagesPool)
Initilize task scheduler internal data structure.