-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nolocal close #1632
base: main
Are you sure you want to change the base?
Nolocal close #1632
Conversation
It still failed when I tested with the following code use std::sync::OnceLock;
use zenoh::{Config, Session, Wait};
static SESSION: OnceLock<Session> = OnceLock::new();
fn main() {
let s = SESSION.get_or_init(|| zenoh::open(Config::default()).wait().unwrap());
println!("> zid: {}", s.zid());
unsafe { libc::atexit(close_session) };
}
extern "C" fn close_session() {
SESSION.get().unwrap().close().wait().unwrap();
} |
Tokio (and some other nolocal-unsafe libs) does not allow interacting with it's objects from The current Close implementation in this PR does not intend It is possible to make close to be both callable and waitable inside @Mallets @evshary I will implement the described approach in this PR next |
Implement close in the way it can be safely waited and awaited in atexit