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 ThreadKeys. 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_innertointo_childfor lock collections try_locknow returns aResultinstead of anOptionRawLocknow has a requiredpoisonmethod- Locks poison themselves when the
RawMutexorRawRwLockpanics - All
RawLockmethods have been renamed - Some APIs have moved from
LockabletoSharable
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
Poisonablewrapper - Removed examples and integration tests from the download bundle
- The
thread_localandonce_celldependencies have been dropped - New
LockableIntoInnerandLockableAsMuttraits - impl
RawLockforLockCollection LockCollection::childandLockCollection::child_mutThreadKeyusesCell<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
BoxedLockCollectionno longer uses a box internally, which required addingDrop,SendandSyncimpls- 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
LockCollectionhas been replaced with four different lock collection types. A sensible default is still aliased asLockCollection- The
Lockabletrait has been removed, and replaced with two new traits: a new trait sharing the same name (Lockable), andRawLock OwnedLockableno longer has a lifetime. Why did I ever give it one?LockableandOwnedLockableare no longer top-level exports. They're hidden in thelockablemodule now.Mutex::get_mutandRwLock::get_muthave been removed. Useas_mutinstead.- A few methods are now
must_use
Minor Changes
- Updated documentation and examples
ReadLockandWriteLockare 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
Debugformat forWriteLockno 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
LockCollectionshould be used with tuples - Sorted the list of pointers in
try_newbefore doing the comparison