Skip to content

Releases: botahamec/happylock

v0.4.2

12 Jan 20:21
Compare
Choose a tag to compare

This fixes a bug where if you put a Poisonable inside of a LockCollection, then it returns a PoisonError if it is not poisoned.

v0.4.1

07 Jan 14:19
Compare
Choose a tag to compare

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

26 Dec 19:07
Compare
Choose a tag to compare

Breaking Changes

  • The MSRV is now Rust 1.82
  • Replaced impl<L> AsRef<L> for LockCollection<L> with impl<T, L: AsRef<T>> AsRef<T> for LockCollection<L>
  • Replaced impl<L> AsMut<L> for LockCollection<L> with impl<T, L: AsMut<T>> AsMut<T> for LockCollection<L>
  • Renamed into_inner to into_child for lock collections
  • try_lock now returns a Result instead of an Option
  • RawLock now has a required poison method
  • Locks poison themselves when the RawMutex or RawRwLock panics
  • All RawLock methods have been renamed
  • Some APIs have moved from Lockable to Sharable

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 requires L: 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 and once_cell dependencies have been dropped
  • New LockableIntoInner and LockableAsMut traits
  • impl RawLock for LockCollection
  • LockCollection::child and LockCollection::child_mut
  • ThreadKey uses Cell<bool> instead of AtomicBool
  • Guards implement common traits like Eq, Ord, and Hash
  • Lots of unit testing

Documentation: https://docs.rs/happylock/0.4.0/happylock/index.html
Full Changelog: v0.3...v0.4

v0.3

16 Jul 21:14
4b0a7f7
Compare
Choose a tag to compare

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 adding Drop, Send and Sync 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

24 May 01:05
Compare
Choose a tag to compare

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 as LockCollection
  • The Lockable trait has been removed, and replaced with two new traits: a new trait sharing the same name (Lockable), and RawLock
  • OwnedLockable no longer has a lifetime. Why did I ever give it one?
  • Lockable and OwnedLockable are no longer top-level exports. They're hidden in the lockable module now.
  • Mutex::get_mut and RwLock::get_mut have been removed. Use as_mut instead.
  • A few methods are now must_use

Minor Changes

  • Updated documentation and examples
  • ReadLock and WriteLock are now repr(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 for WriteLock no longer says ReadLock

Full Changelog: v0.1.5...v0.2

v0.1.5

15 Mar 16:31
Compare
Choose a tag to compare

Changelog:

  • Reverts a buggy change made in v0.1.2 which caused bugs
  • Adds std::thread::yield to Lockable implementations to prevent spinlock behavior

v0.1.2

14 Mar 02:00
Compare
Choose a tag to compare

I made some performance improvements that didn't require breaking changes:

  • LockCollection<[T; N]>, LockCollection<Box<[T]>> and LockCollection<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

v0.1.1

12 Mar 15:23
Compare
Choose a tag to compare

Fixed some trait bounds issues