Author: tjansen Date: Wed Oct 21 14:11:46 2009 New Revision: 1255 Log: Updated scheduler documentation. Modified: trunk/libpisa/scheduler.c Modified: trunk/libpisa/scheduler.c ============================================================================== --- trunk/libpisa/scheduler.c Wed Oct 21 13:54:10 2009 (r1254) +++ trunk/libpisa/scheduler.c Wed Oct 21 14:11:46 2009 (r1255) @@ -18,6 +18,8 @@ /** * Main function of the scheduler thread + * + * @param arg scheduler */ static void *pisa_sched_main(void *arg) { @@ -25,6 +27,8 @@ struct timeval timeout, now; pisa_scheduler *sched = (pisa_scheduler *)arg; + /* The first select call will return immediately, real initialization + * is done after that. */ timerclear(&timeout); while (1) { @@ -33,7 +37,7 @@ select(sched->pipe_sched[0] + 1, &fds, NULL, NULL, &timeout); if (FD_ISSET(sched->pipe_sched[0], &fds)) { - /* Someone woke us up to reschedule, read the bytes */ + /* Someone woke us up to reschedule, read the byte */ char c; read(sched->pipe_sched[0], &c, 1); } @@ -64,7 +68,7 @@ * Initialize the scheduler. Create a thread that sleeps until the first * element in the list is due. * - * @param p pipe to the main thread + * @param sched scheduler */ void pisa_sched_init(pisa_scheduler *sched) { @@ -89,6 +93,8 @@ /** * Clean up the scheduler. Free the task list and kill the thread. + * + * @param sched scheduler */ void pisa_sched_cleanup(pisa_scheduler *sched) { @@ -110,6 +116,7 @@ * Remove a task from the list. This function assumes that the mutex is * locked. * + * @param sched scheduler * @param task task to be removed from the schedule */ static void pisa_sched_remove_internal(pisa_scheduler *sched, pisa_sched_task *task) @@ -131,8 +138,10 @@ } /** - * Run scheduled actions. Called by the main thread eventually if we set the - * shared variable to a value != 0. Handle all actions that are due. + * Run scheduled actions. Called by the main thread eventually if we write to + * pipe_main. Handle all actions that are due. + * + * @param sched scheduler */ void pisa_sched_run(pisa_scheduler *sched) { @@ -173,6 +182,7 @@ /** * Schedule a new task. * + * @param sched scheduler * @param func function to run once the task is due * @param delay delay until the function is run * @param data opaque payload @@ -210,6 +220,7 @@ /** * Remove a scheduled task. * + * @param sched scheduler * @param task task to be removed from the schedule */ void pisa_sched_remove(pisa_scheduler *sched, pisa_sched_task *task)