Function rmw_destroy_subscription

Function Documentation

rmw_ret_t rmw_destroy_subscription(rmw_node_t *node, rmw_subscription_t *subscription)

Finalize a given subscription handle, reclaim the resources, and deallocate the subscription handle. This function will return early if a logical error, namely RMW_RET_INVALID_ARGUMENT or RMW_RET_INCORRECT_RMW_IMPLEMENTATION, ensues, leaving the given subscription handle unchanged. Otherwise, it will proceed despite errors, freeing as many resources as it can, including the subscription handle, and return RMW_RET_ERROR. Usage of a deallocated subscription handle is undefined behavior.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

No

Uses Atomics

Maybe [1]

Lock-Free

Maybe [1]

[1] rmw implementation defined, check the implementation documentation

Pre:

Given node must be the one the subscription was registered with.

Parameters:
  • node[in] Handle to node with which the given subscription is registered

  • subscription[in] Handle to subscription to be finalized

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if node or subscription is NULL, or

Returns:

RMW_RET_INCORRECT_RMW_IMPLEMENTATION if node or subscription implementation identifier does not match, or

Returns:

RMW_RET_ERROR if an unexpected error occurs.