Function rcl_timer_exchange_callback

Function Documentation

rcl_timer_callback_t rcl_timer_exchange_callback(rcl_timer_t *timer, const rcl_timer_callback_t new_callback)

Exchange the current timer callback and return the current callback.

This function can fail, and therefore return NULL, if:

  • timer is NULL

  • timer has not been initialized (the implementation is invalid)

This function can set callback to NULL, in which case the callback is ignored when rcl_timer_call is called.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

Yes

Lock-Free

Yes [1]

[1] if returns true for

Parameters:
  • timer[inout] handle to the timer from the callback should be exchanged

  • new_callback[in] the callback to be exchanged into the timer

Returns:

function pointer to the old callback, or NULL if an error occurred