Function rcl_context_get_instance_id

Function Documentation

rcl_context_instance_id_t rcl_context_get_instance_id(const rcl_context_t *context)

Returns an unsigned integer that is unique to the given context, or 0 if invalid.

The given context must be non-NULL, but does not need to be initialized or valid. If context is NULL, then 0 will be returned. If context is uninitialized, then it is undefined behavior.

The instance ID may be 0 if the context is zero-initialized or if the context has been invalidated by rcl_shutdown().

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

Yes

Lock-Free

Yes [1]

[1] if returns true for

Parameters:

context[in] object from which the instance id should be retrieved

Returns:

a unique id specific to this context instance, or

Returns:

0 if invalid, or

Returns:

0 if context is NULL