From 4caa2081e32f7b0651aab035585bfcb97ce695da Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Fri, 5 Apr 2024 04:17:14 +0000 Subject: [PATCH] Remove the need for lazy_static Signed-off-by: Michael X. Grey --- rclrs/Cargo.toml | 3 --- rclrs/src/context.rs | 14 ++++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/rclrs/Cargo.toml b/rclrs/Cargo.toml index 14a8e9e91..8ea67974b 100644 --- a/rclrs/Cargo.toml +++ b/rclrs/Cargo.toml @@ -23,9 +23,6 @@ cfg-if = "1.0.0" # Needed for clients futures = "0.3" -# Needed to create a global mutex for managing the lifecycles of middleware entities -lazy_static = "1.4" - # Needed for dynamic messages libloading = { version = "0.8", optional = true } diff --git a/rclrs/src/context.rs b/rclrs/src/context.rs index ad82c680e..7e69d7d09 100644 --- a/rclrs/src/context.rs +++ b/rclrs/src/context.rs @@ -7,14 +7,12 @@ use std::vec::Vec; use crate::rcl_bindings::*; use crate::{RclrsError, ToResult}; -lazy_static::lazy_static! { - /// This is locked whenever initializing or dropping any middleware entity - /// because we have found issues in RCL and some RMW implementations that - /// make it unsafe to simultaneously initialize and/or drop various types of - /// entities. It seems these C and C++ based libraries will regularly use - /// unprotected global variables in their object initialization and cleanup. - pub(crate) static ref ENTITY_LIFECYCLE_MUTEX: Mutex<()> = Mutex::new(()); -} +/// This is locked whenever initializing or dropping any middleware entity +/// because we have found issues in RCL and some RMW implementations that +/// make it unsafe to simultaneously initialize and/or drop various types of +/// entities. It seems these C and C++ based libraries will regularly use +/// unprotected global variables in their object initialization and cleanup. +pub(crate) static ENTITY_LIFECYCLE_MUTEX: Mutex<()> = Mutex::new(()); impl Drop for rcl_context_t { fn drop(&mut self) {