![]() |
Oyranos Color Management System API - Version 0.9.6 |
Asynchron processing support. More...
![]() |
Data Structures | |
struct | oyJob_s |
Asynchron job ticket. More... | |
Typedefs | |
typedef int(* | oyJob_Add_f) (oyJob_s **job, int finished) |
Add one unique oyJob_s to the job qeue. More... | |
typedef int(* | oyJob_Get_f) (oyJob_s **job, int finished) |
Get one unique oyJob_s from the job qeue. More... | |
typedef int(* | oyMsg_Add_f) (oyJob_s *job, double progress_zero_till_one, char **status_text) |
Add one unique message from the message qeue. More... | |
typedef void(* | oyJobResult_f) (void) |
Poll for new Jobs. More... | |
typedef void(* | oyJobCallback_f) (double progress_zero_till_one, char *status_text, int thread_id_, int job_id, oyStruct_s *cb_progress_context) |
Progress callback for parallel job processing. More... | |
Functions | |
void | oyThreadLockingSet (oyStruct_LockCreate_f createLockFunc, oyLockRelease_f releaseLockFunc, oyLock_f lockFunc, oyUnLock_f unlockFunc) |
set locking functions for threaded applications More... | |
int | oyThreadLockingReady (void) |
tell if thread locking is ready More... | |
void | oyJob_s::oyJobHandlingSet (oyJob_Add_f jadd, oyJob_Get_f jget, oyMsg_Add_f madd, oyJobResult_f result, const char *nick) |
Initialise the oyJob_s APIs. More... | |
oyJob_s::oyJob_New | |
Allocate a new oyJob_s object. More... | |
oyJob_s::oyJob_Release | |
Deallocate a oyJob_s object. More... | |
Variables | |
oyJob_Add_f | oyJob_s::oyJob_Add = oyJob_AddInit |
Add one unique oyJob_s to the job qeue. More... | |
oyJob_Get_f | oyJob_s::oyJob_Get = oyJob_GetInit |
Get one unique oyJob_s from the job qeue. More... | |
oyMsg_Add_f | oyJob_s::oyMsg_Add = oyMsg_AddInit |
Add one unique message from the message qeue. More... | |
oyJobResult_f | oyJob_s::oyJobResult = oyJobResultInit |
Poll for new Jobs. More... | |
Asynchron processing support.
Threading support in Oyranos is kept intentionally simple. Object level locking is available. Eigther avoid Oyranos locking by encapsulating it into a own locking model. Or provide locking functions in oyThreadLockingSet(), which can detect recursive lock conditions. Recursive locks might not be a problem with POSIX systems and pthreads PTHREAD_MUTEX_RECURSIVE.
Job handling is more complex. A version is provided in the "trds" module and will be initialised by default during first use of the APIs. This version used a threading model as is available during compilation. In case you want a own threading model you can provide it through oyJobHandlingSet().
Some expensive workload is good to load off to a background job and continue in the foreground for non interupted user interaction. E.g. the user should be able to continue interacting with the image/movie, even while changed options need computing of the current DAG contexts.
The background jobs tend to be related to tasks inside the Oyranos DAG and can not easily be handled outside the DAG. For instance it is not easy to replace a expensive DAG while performing a expensive option change - big image or movie + switching on/off proofing/effects.
Threading models can very easily conflict and linking can become a night mare. Thus threading from "trds" must be replaceable on the descretion of users.
Call oyThreadLockingSet() in order to use own thread locking functions. Call oyJobHandlingSet() to replace by own Job handling functions. The functions must be used before any call to Oyranos.
oyJob_Add_f |
Add one unique oyJob_s to the job qeue.
oyJob_Get_f |
Get one unique oyJob_s from the job qeue.
oyJobCallback_f |
Progress callback for parallel job processing.
oyJobResult_f |
Poll for new Jobs.
oyMsg_Add_f |
Add one unique message from the message qeue.
oyJob_New |
Allocate a new oyJob_s object.
A object argument is ignored.
oyJob_Release |
void oyJobHandlingSet | ( | oyJob_Add_f | jadd, |
oyJob_Get_f | jget, | ||
oyMsg_Add_f | madd, | ||
oyJobResult_f | result, | ||
const char * | nick | ||
) |
Initialise the oyJob_s APIs.
Be careful to set the APIs only before any call to the oyJob_s functions. Otherwise the behaviour is undefined.
References OY_TYPE_STD, oyJob_s::oyJob_Add, oyJob_s::oyJob_Get, oyJob_s::oyJobResult, oyJob_s::oyMsg_Add, oyOptions_s::oyOptions_Handle(), oyOptions_s::oyOptions_New(), and oyOptions_s::oyOptions_Release().
int oyThreadLockingReady | ( | void | ) |
tell if thread locking is ready
void oyThreadLockingSet | ( | oyStruct_LockCreate_f | createLockFunc, |
oyLockRelease_f | releaseLockFunc, | ||
oyLock_f | lockFunc, | ||
oyUnLock_f | unlockFunc | ||
) |
set locking functions for threaded applications
Function: oyThreadLockingSet
oyJob_Add_f oyJob_Add = oyJob_AddInit |
Add one unique oyJob_s to the job qeue.
Referenced by oyJob_s::oyJobHandlingSet().
oyJob_Get_f oyJob_Get = oyJob_GetInit |
Get one unique oyJob_s from the job qeue.
Referenced by oyJob_s::oyJobHandlingSet().
oyJobResult_f oyJobResult = oyJobResultInit |
Poll for new Jobs.
Referenced by oyJob_s::oyJobHandlingSet().
oyMsg_Add_f oyMsg_Add = oyMsg_AddInit |
Add one unique message from the message qeue.
Referenced by oyJob_s::oyJobHandlingSet().