Skip to content

Commit

Permalink
add Session::is_closed method (eclipse-zenoh#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 authored Nov 20, 2024
1 parent 4ad359d commit 7d63269
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/zenoh/api/session.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ class Session : public Owned<::z_owned_session_t> {
/// @param err if not null, the result code will be written to this location, otherwise ZException exception will be
/// thrown in case of error.
/// @return declared ``zenoh::ext::PublicationCache`` instance.
/// @note Zenoh-c only.
[[nodiscard]] ext::PublicationCache declare_publication_cache(
const KeyExpr& key_expr, PublicationCacheOptions&& options = PublicationCacheOptions::create_default(),
ZResult* err = nullptr) {
Expand Down Expand Up @@ -1081,7 +1082,10 @@ class Session : public Owned<::z_owned_session_t> {
interop::as_loaned_c_ptr(key_expr), &opts);
__ZENOH_RESULT_CHECK(res, err, "Failed to declare Background Publication Cache");
}

#endif

/// @brief Check if session is closed.
/// @return ``true`` if session is closed, ``false`` otherwise.
bool is_closed() const { return ::z_session_is_closed(interop::as_loaned_c_ptr(*this)); }
};
} // namespace zenoh

0 comments on commit 7d63269

Please sign in to comment.