Function rcl_guard_condition_init_from_rmw

Function Documentation

rcl_ret_t rcl_guard_condition_init_from_rmw(rcl_guard_condition_t *guard_condition, const rmw_guard_condition_t *rmw_guard_condition, rcl_context_t *context, const rcl_guard_condition_options_t options)

Same as rcl_guard_condition_init(), but reusing an existing rmw handle.

In addition to the documentation for rcl_guard_condition_init(), the rmw_guard_condition parameter must not be NULL and must point to a valid rmw guard condition.

Also the life time of the rcl guard condition is tied to the life time of the rmw guard condition. So if the rmw guard condition is destroyed before the rcl guard condition, the rcl guard condition becomes invalid.

Similarly if the resulting rcl guard condition is fini’ed before the rmw guard condition, then the rmw guard condition is no longer valid.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • guard_condition[inout] preallocated guard_condition structure

  • rmw_guard_condition[in] existing rmw guard condition to reuse

  • context[in] the context instance with which the rmw guard condition was initialized with, i.e. the rmw context inside rcl context needs to match rmw context in rmw guard condition

  • options[in] the guard_condition’s options

Returns:

RCL_RET_OK if guard_condition was initialized successfully, or

Returns:

RCL_RET_ALREADY_INIT if the guard condition is already initialized, or

Returns:

RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or

Returns:

RCL_RET_BAD_ALLOC if allocating memory failed, or

Returns:

RCL_RET_ERROR if an unspecified error occurs.