Releases: botahamec/happylock
v0.4.2
v0.4.1
Just a small update.
ThreadKey
is now Sync
A &ThreadKey
is completely useless, so for the same reason that Exclusive
is allowed to be Sync
, now the ThreadKey
is Sync
. This allows MutexGuard
to also be Sync
, which was a major difference between the standard library and this crate. However, also like the std::sync::MutexGuard
, happylock::mutex::MutexGuard
will never be Send
. Dropping the ThreadKey
on the wrong thread could lead to a thread having multiple ThreadKey
s. MutexRef
can still be Send
, as it does not hold a ThreadKey
.
Full Changelog: v0.4...v0.4.1
v0.4
Breaking Changes
- The MSRV is now Rust 1.82
- Replaced
impl<L> AsRef<L> for LockCollection<L>
withimpl<T, L: AsRef<T>> AsRef<T> for LockCollection<L>
- Replaced
impl<L> AsMut<L> for LockCollection<L>
withimpl<T, L: AsMut<T>> AsMut<T> for LockCollection<L>
- Renamed
into_inner
tointo_child
for lock collections try_lock
now returns aResult
instead of anOption
RawLock
now has a requiredpoison
method- Locks poison themselves when the
RawMutex
orRawRwLock
panics - All
RawLock
methods have been renamed - Some APIs have moved from
Lockable
toSharable
Bug fixes
- Some lock collection types would allow duplicate locks in MIRI. This no longer happens.
- Fixed memory leaks in
BoxedLockCollection
impl<L: OwnedLockable> From<L> for LockCollection<L>
no longer requiresL: Default
- LockCollections can recover and unlock previously locked locks when locking panics
Other Changes
- New
Poisonable
wrapper - Removed examples and integration tests from the download bundle
- The
thread_local
andonce_cell
dependencies have been dropped - New
LockableIntoInner
andLockableAsMut
traits - impl
RawLock
forLockCollection
LockCollection::child
andLockCollection::child_mut
ThreadKey
usesCell<bool>
instead ofAtomicBool
- Guards implement common traits like
Eq
,Ord
, andHash
- Lots of unit testing
Documentation: https://docs.rs/happylock/0.4.0/happylock/index.html
Full Changelog: v0.3...v0.4
v0.3
A bit of fix for undefined behavior from v0.2
Breaking Changes
- Removed
impl<'a, L> IntoIterator for &'a mut BoxedLockCollection<L>
- Removed
impl<E: OwnedLockable + Extend<L>, L: OwnedLockable> Extend<L> for BoxedLockCollection<E>
- Removed
impl<L> AsMut<L> for BoxedLockCollection<L>
- Removed
BoxedLockCollection::iter_mut
Other Changes
BoxedLockCollection
no longer uses a box internally, which required addingDrop
,Send
andSync
impls- Added
impl Debug for RwLockWriteRef
- Added
impl Debug for RwLockWriteGuard
- Added
impl Debug for RwLockReadRef
- Added
impl Debug for RwLockReadGuard
Full Changelog: v0.2...v0.3
v0.2
A big update which utilizes cyclic wait prevention for better performance. Also, the Sharable
API is here.
Breaking Changes
LockCollection
has been replaced with four different lock collection types. A sensible default is still aliased asLockCollection
- The
Lockable
trait has been removed, and replaced with two new traits: a new trait sharing the same name (Lockable
), andRawLock
OwnedLockable
no longer has a lifetime. Why did I ever give it one?Lockable
andOwnedLockable
are no longer top-level exports. They're hidden in thelockable
module now.Mutex::get_mut
andRwLock::get_mut
have been removed. Useas_mut
instead.- A few methods are now
must_use
Minor Changes
- Updated documentation and examples
ReadLock
andWriteLock
are nowrepr(transparent)
unsafe fn RwLock::raw()
unsafe fn Mutex::raw()
impl<...> Default for Mutex<T, R>
impl<...> Default for RwLock<T, R>
impl<...> Debug for MutexRef<'a, T, R>
impl<...> Display for MutexRef<'a, T, R>
impl<...> Debug for MutexGuard<'a, 'key, T, Key, R>
impl<...> Display for MutexGuard<'a, 'key, T, Key, R>
impl<...> Debug for RwLockReadRef<'a, T, R>
impl<...> Display for RwLockReadRef<'a, T, R>
impl<...> Debug for RwLockReadGuard<'a, 'key, T, Key, R>
impl<...> Display for RwLockReadGuard<'a, 'key, T, Key, R>
impl<...> AsRef<T> for MutexRef<'a, T, R>
impl<...> AsMut<T> for MutexRef<'a, T, R>
impl<...> AsRef<T> for MutexGuard<'a, 'key, T, Key, R>
impl<...> AsMut<T> for MutexGuard<'a, 'key, T, Key, R>
impl<...> AsRef<T> for RwLockReadRef<'a, T, R>
impl<...> AsRef<T> for RwLockReadGuard<'a, 'key, T, Key, R>
impl<...> AsRef<T> for RwLockWriteRef<'a, T, R>
impl<...> AsMut<T> for RwLockWriteRef<'a, T, R>
impl<...> AsRef<T> for RwLockWriteGuard<'a, 'key, T, Key, R>
impl<...> AsMut<T> for RwLockWriteGuard<'a, 'key, T, Key, R>
Bug fixes
- The
Debug
format forWriteLock
no longer saysReadLock
Full Changelog: v0.1.5...v0.2
v0.1.5
v0.1.2
I made some performance improvements that didn't require breaking changes:
LockCollection<[T; N]>
,LockCollection<Box<[T]>>
andLockCollection<Vec<T>>
now behave less like spinlocks when their first element isn't locked- Added notes for how
LockCollection
should be used with tuples - Sorted the list of pointers in
try_new
before doing the comparison