Function rcl_wait_set_resize

Function Documentation

rcl_ret_t rcl_wait_set_resize(rcl_wait_set_t *wait_set, size_t subscriptions_size, size_t guard_conditions_size, size_t timers_size, size_t clients_size, size_t services_size, size_t events_size)

Reallocate space for entities in the wait set.

This function will deallocate and reallocate the memory for all entity sets.

A size of 0 will just deallocate the memory and assign NULL to the array.

Allocation and deallocation is done with the allocator given during the wait set’s initialization.

After calling this function all values in the set will be set to NULL, effectively the same as calling rcl_wait_set_clear(). Similarly, the underlying rmw representation is reallocated and reset: all entries are set to NULL and the count is set to zero.

If the requested size matches the current size, no allocation will be done.

This can be called on an uninitialized (zero initialized) wait set.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • wait_set[inout] struct to be resized

  • subscriptions_size[in] a size for the new subscriptions set

  • guard_conditions_size[in] a size for the new guard conditions set

  • timers_size[in] a size for the new timers set

  • clients_size[in] a size for the new clients set

  • services_size[in] a size for the new services set

  • events_size[in] a size for the new events set

Returns:

RCL_RET_OK if resized successfully, 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.