Function rcutils_get_zero_initialized_array_list

Function Documentation

rcutils_array_list_t rcutils_get_zero_initialized_array_list(void)

Return an empty array_list struct.

This function returns an empty and zero initialized array_list struct. Calling rcutils_array_list_fini() on any non-initialized instance leads to undefined behavior. Every instance of array_list_t has to either be zero_initialized with this function or manually allocated.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

No

Lock-Free

Yes

Example:

rcutils_array_list_t foo;
rcutils_array_list_fini(&foo); // undefined behavior!

rcutils_array_list_t bar = rcutils_get_zero_initialized_array_list();
rcutils_array_list_fini(&bar); // ok