Skip to content

Scheduler (function list)

Status: Implemented (API 1.24). Generated from client/clight/idl/clight_api.json by tools/docs/gen_api_reference.py; do not edit by hand. 5 functions, the newest from API 1.0.

Explanations and examples: Scheduler. Every function of the sched module is listed here in table order. The details of each function follow the table, in the same order. Side: where the function works (server, client, both). Context: the thread it may be called on (Conventions). Since: the API version that added it.

C function Lua Side Context Since
cl_sched_run_server cl.sched.run_server server ANY 1.0
cl_sched_repeat_server cl.sched.repeat_server server ANY 1.0
cl_sched_run_client cl.sched.run_client client ANY 1.0
cl_task_cancel cl.task.cancel both ANY 1.0
cl_task_is_pending cl.task.is_pending both ANY 1.0

cl_sched_run_server

cl_result cl_sched_run_server(int32_t delay_ticks, cl_task_fn fn, void* user, cl_task* out);

Runs on the server tick thread after delay_ticks (0 = the next tick). Callable from any thread.

  • Side: server. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.sched.run_server
  • C++: clight::sched::run_server(int32_t delay_ticks, cl_task_fn fn, void* user) → Expected<Task>
  • The last parameter receives the result. Lua returns it; C++ returns it in Expected<T>.
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_sched_repeat_server

cl_result cl_sched_repeat_server(int32_t delay_ticks, int32_t period_ticks, cl_task_fn fn, void* user, cl_task* out);
  • Side: server. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.sched.repeat_server
  • C++: clight::sched::repeat_server(int32_t delay_ticks, int32_t period_ticks, cl_task_fn fn, void* user) → Expected<Task>
  • The last parameter receives the result. Lua returns it; C++ returns it in Expected<T>.
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_sched_run_client

cl_result cl_sched_run_client(int32_t delay_ticks, cl_task_fn fn, void* user, cl_task* out);
  • Side: client. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.sched.run_client
  • C++: clight::sched::run_client(int32_t delay_ticks, cl_task_fn fn, void* user) → Expected<Task>
  • The last parameter receives the result. Lua returns it; C++ returns it in Expected<T>.
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_task_cancel

cl_result cl_task_cancel(cl_task t);
  • Side: both. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.task.cancel, task:cancel(...), cl.sched.task_cancel (old name)
  • C++: Task::cancel()
  • Returns CL_OK or an error code (Error codes). Lua raises a cl.Error on failure.

cl_task_is_pending

bool cl_task_is_pending(cl_task t);
  • Side: both. Context: ANY (any thread). Since: API 1.0.
  • Lua: cl.task.is_pending, task:is_pending(...), cl.sched.task_is_pending (old name)
  • C++: Task::is_pending() → bool; clight::sched::task_is_pending(Task t) → bool