Skip to content

File syn_timer_wheel.c

FileList > sched > syn_timer_wheel.c

Go to the source code of this file

Hashed Timing Wheel Scheduler implementation.

  • #include "syn_timer_wheel.h"
  • #include "../util/syn_assert.h"
  • #include <string.h>

Public Functions

Type Name
SYN_Status syn_timer_wheel_add (SYN_TimerWheel * wheel, SYN_TimerWheelNode * node, uint32_t delay_ticks, SYN_TimerWheelCb cb, void * arg)
Schedule a timer in the timing wheel.
SYN_Status syn_timer_wheel_cancel (SYN_TimerWheel * wheel, SYN_TimerWheelNode * node)
Cancel a scheduled timer node.
SYN_Status syn_timer_wheel_init (SYN_TimerWheel * wheel)
Initialize a timing wheel scheduler.
size_t syn_timer_wheel_step (SYN_TimerWheel * wheel)
Advance the timing wheel by one tick and fire expired timers.

Public Functions Documentation

function syn_timer_wheel_add

Schedule a timer in the timing wheel.

SYN_Status syn_timer_wheel_add (
    SYN_TimerWheel * wheel,
    SYN_TimerWheelNode * node,
    uint32_t delay_ticks,
    SYN_TimerWheelCb cb,
    void * arg
) 

Parameters:

  • wheel Pointer to wheel descriptor.
  • node Pointer to timer node memory.
  • delay_ticks Delay in ticks before timer fires.
  • cb Expiration callback.
  • arg Callback user argument.

Returns:

SYN_OK on success.


function syn_timer_wheel_cancel

Cancel a scheduled timer node.

SYN_Status syn_timer_wheel_cancel (
    SYN_TimerWheel * wheel,
    SYN_TimerWheelNode * node
) 

Parameters:

  • wheel Pointer to wheel descriptor.
  • node Pointer to timer node.

Returns:

SYN_OK on success.


function syn_timer_wheel_init

Initialize a timing wheel scheduler.

SYN_Status syn_timer_wheel_init (
    SYN_TimerWheel * wheel
) 

Parameters:

  • wheel Pointer to wheel descriptor.

Returns:

SYN_OK on success.


function syn_timer_wheel_step

Advance the timing wheel by one tick and fire expired timers.

size_t syn_timer_wheel_step (
    SYN_TimerWheel * wheel
) 

Parameters:

  • wheel Pointer to wheel descriptor.

Returns:

Number of timers fired during this tick step.



The documentation for this class was generated from the following file src/syntropic/sched/syn_timer_wheel.c