Skip to content

Commit

Permalink
fix(zenoh-runtime): zenoh-c DLL crash in libc::atexit handler
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanYuYuan committed Apr 25, 2024
1 parent 9a9832a commit 255b1c9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions commons/zenoh-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ pub struct ZRuntimePool(HashMap<ZRuntime, OnceLock<Runtime>>);

impl ZRuntimePool {
fn new() -> Self {
// NOTE: The atexit handler in DLL cannot spawn the new thread in `cleanup`
#[cfg(not(all(target_os = "windows")))]
// Register a callback to clean the static variables.
unsafe {
libc::atexit(cleanup);
Expand Down

0 comments on commit 255b1c9

Please sign in to comment.