Skip to content

Commit

Permalink
Merge branch 'master' into feat-const-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar authored Dec 7, 2023
2 parents 2887ee0 + 3ec20ad commit 5bad80d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "try-lock"
version = "0.2.3" # remember to update html_root_url
version = "0.2.4" # remember to update html_root_url
description = "A lightweight atomic lock."
keywords = ["lock", "atomic"]
categories = ["concurrency", "no-std"]
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use core::cell::UnsafeCell;
use core::fmt;
use core::ops::{Deref, DerefMut};
use core::sync::atomic::{AtomicBool, Ordering};
use core::marker::PhantomData;

/// A light-weight lock guarded by an atomic boolean.
///
Expand Down Expand Up @@ -167,6 +168,7 @@ impl<T> TryLock<T> {
Some(Locked {
lock: self,
order: unlock_order,
_p: PhantomData,
})
} else {
None
Expand Down Expand Up @@ -216,6 +218,8 @@ impl<T: fmt::Debug> fmt::Debug for TryLock<T> {
pub struct Locked<'a, T: 'a> {
lock: &'a TryLock<T>,
order: Ordering,
/// Suppresses Send and Sync autotraits for `struct Locked`.
_p: PhantomData<*mut T>,
}

impl<'a, T> Deref for Locked<'a, T> {
Expand Down

0 comments on commit 5bad80d

Please sign in to comment.