static bool sol_worker_thread_feedback_dispatch(void *data) { struct sol_worker_thread_posix *thread = data; if (sol_worker_thread_lock(thread)) { thread->idler = NULL; sol_worker_thread_unlock(thread); } thread->spec.feedback((void *)thread->spec.data); return false; }
void sol_worker_thread_impl_feedback(void *handle) { struct sol_worker_thread_posix *thread = handle; SOL_NULL_CHECK(thread); SOL_NULL_CHECK(thread->config.feedback); if (sol_worker_thread_impl_cancel_check(thread)) { SOL_WRN("worker thread %p is not running.", thread); return; } if (thread->thread != pthread_self()) { SOL_WRN("trying to feedback from different worker thread %p.", thread); return; } if (sol_worker_thread_lock(thread)) { if (!thread->idler) thread->idler = sol_idle_add(sol_worker_thread_feedback_dispatch, thread); sol_worker_thread_unlock(thread); } }