Function rmw_compare_gids_equal

Function Documentation

rmw_ret_t rmw_compare_gids_equal(const rmw_gid_t *gid1, const rmw_gid_t *gid2, bool *result)

Check if two globally unique identifiers (GIDs) are equal.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

Yes

Uses Atomics

Maybe [1]

Lock-Free

Maybe [1]

[1] implementation defined, check implementation documentation.

Thread-safety

Unique identifier comparison is a reentrant function, but:

  • Access to both GIDs is read-only but it is not synchronized. Concurrent gid1 and gid2 reads are safe, but concurrent reads and writes are not.

  • Access to primitive data-type arguments is not synchronized. It is not safe to read or write result while rmw_compare_gids_equal() uses it.

Parameters:
  • gid1[in] First unique identifier to compare.

  • gid2[in] Second unique identifier to compare.

  • result[out] true if both GIDs are equal, false otherwise.

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if gid1 or gid2 is NULL, or

Returns:

RMW_RET_INCORRECT_RMW_IMPLEMENTATION if the implementation identifier of gid1 or gid2 does not match this implementation, or

Returns:

RMW_RET_ERROR if an unspecified error occurs.