File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,33 @@ RMW_WARN_UNUSED
108108rmw_ret_t
109109rmw_shutdown (rmw_context_t * context );
110110
111+ /// Finalize a context.
112+ /**
113+ * The context to be finalized must have been previously initialized with
114+ * `rmw_init()`, and then later invalidated with `rmw_shutdown()`.
115+ * If context is `NULL`, then `RMW_RET_INVALID_ARGUMENT` is returned.
116+ * If context is zero-initialized, then `RMW_RET_INVALID_ARGUMENT` is returned.
117+ * If context is initialized and valid (`rmw_shutdown()` was not called on it),
118+ * then `RMW_RET_INVALID_ARGUMENT` is returned.
119+ *
120+ * <hr>
121+ * Attribute | Adherence
122+ * ------------------ | -------------
123+ * Allocates Memory | Yes
124+ * Thread-Safe | No
125+ * Uses Atomics | Yes
126+ * Lock-Free | Yes [1]
127+ * <i>[1] if `atomic_is_lock_free()` returns true for `atomic_uint_least64_t`</i>
128+ *
129+ * \return `RMW_RET_OK` if the shutdown was completed successfully, or
130+ * \return `RMW_RET_INVALID_ARGUMENT` if any arguments are invalid, or
131+ * \return `RMW_RET_ERROR` if an unspecified error occur.
132+ */
133+ RMW_PUBLIC
134+ RMW_WARN_UNUSED
135+ rmw_ret_t
136+ rmw_context_fini (rmw_context_t * context );
137+
111138#ifdef __cplusplus
112139}
113140#endif
Original file line number Diff line number Diff line change @@ -521,18 +521,26 @@ rmw_trigger_guard_condition(const rmw_guard_condition_t * guard_condition);
521521
522522/// Create a wait set to store conditions that the middleware will block on.
523523/**
524+ * This function can fail, and therefore return `NULL`, if:
525+ * - context is `NULL`
526+ * - context is invalid
527+ * - memory allocation fails during wait set creation
528+ * - an unspecified error occurs
529+ *
524530 * If `max_conditions` is `0`, the wait set can store an unbounded number of
525531 * conditions to wait on.
526532 * If `max_conditions` is greater than `0`, the number of conditions that can
527533 * be attached to the wait set is bounded at `max_conditions`.
534+ *
535+ * \param[in] context init context that this node should be associated with
528536 * \param[in] max_conditions
529537 * The maximum number of conditions that can be attached to the wait set.
530538 * \return A pointer to the created wait set, `NULL` if an error occurred.
531539 */
532540RMW_PUBLIC
533541RMW_WARN_UNUSED
534542rmw_wait_set_t *
535- rmw_create_wait_set (size_t max_conditions );
543+ rmw_create_wait_set (rmw_context_t * context , size_t max_conditions );
536544
537545RMW_PUBLIC
538546RMW_WARN_UNUSED
You can’t perform that action at this time.
0 commit comments