Function rcl_node_is_valid
Defined in File node.h
Function Documentation
-
bool rcl_node_is_valid(const rcl_node_t *node)
Return
true
if the node is valid, elsefalse
.Also return
false
if the node pointer isNULL
or the allocator is invalid.A node is invalid if:
the implementation is
NULL
(rcl_node_init not called or failed)rcl_shutdown has been called since the node has been initialized
the node has been finalized with rcl_node_fini
There is a possible validity race condition.
Consider:
assert(rcl_node_is_valid(node)); // <-- thread 1 rcl_shutdown(); // <-- thread 2 // use node as if valid // <-- thread 1
In the third line the node is now invalid, even though on the previous line of thread 1 it was checked to be valid. This is why this function is considered not thread-safe.
Attribute
Adherence
Allocates Memory
No
Thread-Safe
No
Uses Atomics
Yes
Lock-Free
Yes [1]
- Parameters:
node – [in] rcl_node_t to be validated
- Returns:
true
if the node and allocator are valid, otherwisefalse
.