Robust Distributed System Nucleus (rDSN)
ver 1.0.0
|
Functions | |
DSN_API dsn_task_t | dsn_task_create (dsn_task_code_t code, dsn_task_handler_t cb, void *context, int hash DEFAULT(0), dsn_task_tracker_t tracker DEFAULT(nullptr)) |
DSN_API dsn_task_t | dsn_task_create_timer (dsn_task_code_t code, dsn_task_handler_t cb, void *context, int hash, int interval_milliseconds, dsn_task_tracker_t tracker DEFAULT(nullptr)) |
DSN_API dsn_task_t | dsn_task_create_ex (dsn_task_code_t code, dsn_task_handler_t cb, dsn_task_cancelled_handler_t on_cancel, void *context, int hash DEFAULT(0), dsn_task_tracker_t tracker DEFAULT(nullptr)) |
DSN_API dsn_task_t | dsn_task_create_timer_ex (dsn_task_code_t code, dsn_task_handler_t cb, dsn_task_cancelled_handler_t on_cancel, void *context, int hash, int interval_milliseconds, dsn_task_tracker_t tracker DEFAULT(nullptr)) |
DSN_API void | dsn_task_call (dsn_task_t task, int delay_milliseconds DEFAULT(0)) |
DSN_API dsn_task_t dsn_task_create | ( | dsn_task_code_t | code, |
dsn_task_handler_t | cb, | ||
void * | context, | ||
int hash | DEFAULT0, | ||
dsn_task_tracker_t tracker | DEFAULTnullptr | ||
) |
create an asynchronous task.
code | the task code, which defines which thread pool executes the task, see dsn_task_code_register for more details. |
cb | the callback for executing the task. |
context | the context used by the callback. |
DEFAULT(0) | the hash value, which defines which thread in the target thread pool executes the task, when the pool is partitioned, see remarks for more. |
DEFAULT(nullptr) | the task tracker handle, see dsn_task_tracker_create for more. |
code defines the thread pool which executes the callback, i.e., [task.code$] pool_code = THREAD_POOL_DEFAULT; hash defines the thread with index hash % worker_count in the threadpool to execute the callback, when [threadpool.pool_code%] partitioned = true.
DSN_API dsn_task_t dsn_task_create_timer | ( | dsn_task_code_t | code, |
dsn_task_handler_t | cb, | ||
void * | context, | ||
int | hash, | ||
int | interval_milliseconds, | ||
dsn_task_tracker_t tracker | DEFAULTnullptr | ||
) |
create a timer task
code | the task code, which defines which thread pool executes the task, see dsn_task_code_register for more details. |
cb | the callback for executing the task. |
context | the context used by the callback. |
DEFAULT(0) | the hash value, which defines which thread in the target thread pool executes the task, when the pool is partitioned, see remarks for more. |
interval_milliseconds | timer interval with which the timer executes periodically. |
DEFAULT(nullptr) | the task tracker handle, see dsn_task_tracker_create for more. |
code defines the thread pool which executes the callback, i.e., [task.code$] pool_code = THREAD_POOL_DEFAULT; hash defines the thread with index hash % worker_count in the threadpool to execute the callback, when [threadpool.pool_code%] partitioned = true.
DSN_API void dsn_task_call | ( | dsn_task_t | task, |
int delay_milliseconds | DEFAULT0 | ||
) |
start the task
task | the task handle |
delay_milliseconds | delay time before its execution |