silc_thread_pool_run

SYNOPSIS

    SilcBool silc_thread_pool_run(SilcThreadPool tp,
                                  SilcBool queueable,
                                  SilcSchedule schedule,
                                  SilcThreadPoolFunc run,
                                  void *run_context,
                                  SilcTaskCallback completion,
                                  void *completion_context);

DESCRIPTION

Run the `run' function with `run_context' in one of the threads in the thread pool. Returns FALSE if the thread pool is being freed. If there are no free threads left in the pool this will queue the `run' and call it once a thread becomes free, if `queueable' is TRUE. If `queueable' is FALSE and there are no free threads, this returns FALSE and `run' is not executed.

If `completion' is non-NULL it will be called to indicate completion of the `run' function. If `schedule' is non-NULL the `completion' will be called through the scheduler in the main thread. If it is NULL the `completion' is called directly from the thread after the `run' has returned.