mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-04 12:10:34 +01:00 
			
		
		
		
	crucible: lockset: add LockSet<T>::Lock make_lock
Before: decltype(foo)::Lock lock(foo, key); After: auto lock = foo.make_lock(key); Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
		@@ -63,6 +63,7 @@ namespace crucible {
 | 
			
		||||
			bool try_lock();
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		Lock make_lock(const key_type &name, bool start_locked = true);
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	template <class T>
 | 
			
		||||
@@ -215,7 +216,7 @@ namespace crucible {
 | 
			
		||||
 | 
			
		||||
	template <class T>
 | 
			
		||||
	LockSet<T>::Lock::Lock(Lock &&that) :
 | 
			
		||||
		m_lockset(that.lockset),
 | 
			
		||||
		m_lockset(that.m_lockset),
 | 
			
		||||
		m_name(that.m_name),
 | 
			
		||||
		m_locked(that.m_locked)
 | 
			
		||||
	{
 | 
			
		||||
@@ -236,6 +237,13 @@ namespace crucible {
 | 
			
		||||
		return *this;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template <class T>
 | 
			
		||||
	typename LockSet<T>::Lock
 | 
			
		||||
	LockSet<T>::make_lock(const key_type &name, bool start_locked)
 | 
			
		||||
	{
 | 
			
		||||
		return Lock(*this, name, start_locked);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif // CRUCIBLE_LOCKSET_H
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user