Function rcl_publisher_get_context

Function Documentation

rcl_context_t *rcl_publisher_get_context(const rcl_publisher_t *publisher)

Return the context associated with this publisher.

This function can fail, and therefore return NULL, if the:

  • publisher is NULL

  • publisher is invalid (never called init, called fini, etc.)

The returned context is made invalid if the publisher is finalized or if rcl_shutdown() is called. Therefore it is recommended to get the handle from the publisher using this function each time it is needed and avoid use of the handle concurrently with functions that might change it.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:

publisher[in] pointer to the rcl publisher

Returns:

context if successful, otherwise NULL