Function rcl_clock_add_jump_callback
Defined in File time.h
Function Documentation
-
rcl_ret_t rcl_clock_add_jump_callback(rcl_clock_t *clock, rcl_jump_threshold_t threshold, rcl_jump_callback_t callback, void *user_data)
Add a callback to be called when a time jump exceeds a threshold.
The callback is called twice when the threshold is exceeded: once before the clock is updated, and once after. The user_data pointer is passed to the callback as the last argument. A callback and user_data pair must be unique among the callbacks added to a clock.
This function is not thread-safe with rcl_clock_remove_jump_callback(), rcl_enable_ros_time_override(), rcl_disable_ros_time_override() nor rcl_set_ros_time_override() functions when used on the same clock object.
Attribute
Adherence
Allocates Memory
Yes
Thread-Safe
No [1]
Uses Atomics
No
Lock-Free
Yes
[1] Function is reentrant, but concurrent calls on the same object are not safe. Thread-safety is also affected by that of the object associated with the object.
- Parameters:
clock – [in] A clock to add a jump callback to.
threshold – [in] Criteria indicating when to call the callback.
callback – [in] A callback to call.
user_data – [in] A pointer to be passed to the callback.
- Returns:
RCL_RET_OK if the callback was added successfully, or
- Returns:
RCL_RET_BAD_ALLOC if a memory allocation failed, or
- Returns:
RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
- Returns:
RCL_RET_ERROR an unspecified error occurs.