From 255b1c987e924d1e36d1c78777e65f7e7a5b26ad Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 25 Apr 2024 17:08:57 +0800 Subject: [PATCH] fix(zenoh-runtime): zenoh-c DLL crash in libc::atexit handler --- commons/zenoh-runtime/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commons/zenoh-runtime/src/lib.rs b/commons/zenoh-runtime/src/lib.rs index 1a9d765420..a53337cd9e 100644 --- a/commons/zenoh-runtime/src/lib.rs +++ b/commons/zenoh-runtime/src/lib.rs @@ -157,6 +157,8 @@ pub struct ZRuntimePool(HashMap>); 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);