Skip to content

Conversation

@DenisBiryukov91
Copy link
Contributor

@DenisBiryukov91 DenisBiryukov91 commented Jan 28, 2026

Description

Add option to wait until related callback execution ends and they are dropped for undeclare() operation for
Publisher, Subscriber, Querier, Queryable, Matching Listener and Session.

What does this PR do?

Add new api that allows to force undeclare to block until all related callback execution finishes. This is in particular useful for c/c++ (or any other non-rust language) bindings to ensure that once corresponding zenoh entity is destroyed, no callbacks will be invoked and no related resources will be accessed.

Why is this change needed?

See above.

Related Issues

Fixes #1818


🏷️ Label-Based Checklist

Based on the labels applied to this PR, please complete these additional requirements:

Labels: enhancement

✨ Enhancement Requirements

Since this PR enhances existing functionality:

  • Enhancement scope documented - Clear description of what is being improved
  • Minimum necessary code - Implementation is as simple as possible, doesn't overcomplicate the system
  • Backwards compatible - Existing code/APIs still work unchanged
  • No new APIs added - Only improving existing functionality
  • Tests updated - Existing tests pass, new test cases added if needed
  • Performance improvement measured - If applicable, before/after metrics provided
  • Documentation updated - Existing docs updated to reflect improvements
  • User impact documented - How users benefit from this enhancement

Remember: Enhancements should not introduce new APIs or breaking changes.

Instructions:

  1. Check off items as you complete them (change - [ ] to - [x])
  2. The PR checklist CI will verify these are completed

This checklist updates automatically when labels change, but preserves your checked boxes.

@DenisBiryukov91 DenisBiryukov91 added the enhancement Existing things could work better label Jan 28, 2026
@DenisBiryukov91 DenisBiryukov91 marked this pull request as draft January 28, 2026 17:41
…ubscriber, Queryable, Querier, Matching listener and Session
@DenisBiryukov91 DenisBiryukov91 force-pushed the wait-callbacks-on-undeclare branch from fa43c72 to e7bcf2f Compare January 28, 2026 17:48
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 90.54878% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.02%. Comparing base (8d059ff) to head (e7bcf2f).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
zenoh/src/api/cancellation.rs 72.58% 17 Missing ⚠️
zenoh/src/api/session.rs 89.15% 9 Missing ⚠️
zenoh/src/api/queryable.rs 81.25% 3 Missing ⚠️
zenoh/src/api/builders/queryable.rs 93.33% 1 Missing ⚠️
zenoh/src/api/builders/subscriber.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2397    +/-   ##
========================================
  Coverage   72.01%   72.02%            
========================================
  Files         390      390            
  Lines       62792    63000   +208     
========================================
+ Hits        45217    45373   +156     
- Misses      17575    17627    +52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Existing things could work better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure that callbacks are never called when subscriber/queryable go out of scope.

1 participant