Function rcl_timer_exchange_period

Function Documentation

rcl_ret_t rcl_timer_exchange_period(const rcl_timer_t *timer, int64_t new_period, int64_t *old_period)

Exchange the period of the timer and return the previous period.

This function exchanges the period in the timer and copies the old one into the given variable.

Exchanging (changing) the period will not affect already waiting wait sets.

The old_period argument must be a pointer to an already allocated int64_t.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

Yes

Lock-Free

Yes [1]

[1] if returns true for

Parameters:
  • timer[in] the handle to the timer which is being modified

  • new_period[out] the int64_t to exchange into the timer

  • old_period[out] the int64_t in which the previous period is stored

Returns:

RCL_RET_OK if the period was retrieved successfully, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_TIMER_INVALID if the timer->impl is invalid, or

Returns:

RCL_RET_ERROR an unspecified error occur.