6#ifndef __CWIST_SCHEDULER_H__
7#define __CWIST_SCHEDULER_H__
Platform Agnostic Async Job Queue Interface.
void(* cwist_job_func)(void *arg)
Job function signature.
void cwist_scheduler_destroy(cwist_scheduler_t *s)
Destroy the scheduler and stop all worker threads.
bool cwist_scheduler_submit(cwist_scheduler_t *s, cwist_job_func func, void *arg)
Submit a job to be executed as soon as a worker is available.
struct cwist_scheduler cwist_scheduler_t
Opaque background job scheduler handle.
bool cwist_scheduler_schedule(cwist_scheduler_t *s, cwist_job_func func, void *arg, uint64_t delay_ms)
Schedule a job to run after a relative delay.
size_t cwist_scheduler_pending_count(cwist_scheduler_t *s)
Number of delayed jobs currently waiting to fire.
size_t cwist_scheduler_cancel_pending(cwist_scheduler_t *s, cwist_scheduler_drop_cb drop_cb)
Cancel all delayed jobs that have not yet fired.
cwist_scheduler_t * cwist_scheduler_create(size_t worker_count, size_t queue_capacity)
Create a scheduler with a pool of background workers.
void(* cwist_scheduler_drop_cb)(void *arg)
Callback invoked for each pending job that is cancelled.