Skip to content

Commit

Permalink
Remove the need for lazy_static
Browse files Browse the repository at this point in the history
Signed-off-by: Michael X. Grey <[email protected]>
  • Loading branch information
mxgrey committed Apr 5, 2024
1 parent 6d90431 commit 4caa208
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
3 changes: 0 additions & 3 deletions rclrs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
14 changes: 6 additions & 8 deletions rclrs/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4caa208

Please sign in to comment.