yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
v1.2.31
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Foundation/NSLock.hpp 4// 5// See LICENSE.txt for this project licensing information. 6// 7//------------------------------------------------------------------------------------------------------------------------------------------------------------- 8 9#pragma once 10 11//------------------------------------------------------------------------------------------------------------------------------------------------------------- 12 13#include "NSDefines.hpp" 14#include "NSObject.hpp" 15#include "NSPrivate.hpp" 16#include "NSTypes.hpp" 17#include "NSDate.hpp" 18 19//------------------------------------------------------------------------------------------------------------------------------------------------------------- 20 21namespace NS 22{ 23 24template < class _Class , class _Base = class Object > 25class Locking : public _Base 26{ 27public : 28void lock () ; 29void unlock () ; 30} ; 31 32class Condition : public Locking < Condition > 33{ 34public : 35static Condition * alloc () ; 36 37Condition * init () ; 38 39void wait () ; 40bool waitUntilDate ( Date * pLimit ) ; 41void signal () ; 42void broadcast () ; 43} ; 44 45} // NS 46 47//------------------------------------------------------------------------------------------------------------------------------------------------------------- 48 49template < class _Class , class _Base /* = NS::Object */ > 50_NS_INLINE void NS :: Locking < _Class , _Base >:: lock () 51{ 52NS :: Object :: sendMessage < void > ( this , _NS_PRIVATE_SEL ( lock )) ; 53} 54 55//------------------------------------------------------------------------------------------------------------------------------------------------------------- 56 57template < class _Class , class _Base /* = NS::Object */ > 58_NS_INLINE void NS :: Locking < _Class , _Base >:: unlock () 59{ 60NS :: Object :: sendMessage < void > ( this , _NS_PRIVATE_SEL ( unlock )) ; 61} 62 63//------------------------------------------------------------------------------------------------------------------------------------------------------------- 64 65_NS_INLINE NS :: Condition * NS :: Condition :: alloc () 66{ 67return NS :: Object :: alloc < NS :: Condition > ( _NS_PRIVATE_CLS ( NSCondition )) ; 68} 69 70//------------------------------------------------------------------------------------------------------------------------------------------------------------- 71 72_NS_INLINE NS :: Condition * NS :: Condition :: init () 73{ 74return NS :: Object :: init < NS :: Condition > () ; 75} 76 77//------------------------------------------------------------------------------------------------------------------------------------------------------------- 78 79_NS_INLINE void NS :: Condition :: wait () 80{ 81NS :: Object :: sendMessage < void > ( this , _NS_PRIVATE_SEL ( wait )) ; 82} 83 84//------------------------------------------------------------------------------------------------------------------------------------------------------------- 85 86_NS_INLINE bool NS :: Condition :: waitUntilDate ( NS :: Date * pLimit ) 87{ 88return NS :: Object :: sendMessage < bool > ( this , _NS_PRIVATE_SEL ( waitUntilDate_ ) , pLimit ) ; 89} 90 91//------------------------------------------------------------------------------------------------------------------------------------------------------------- 92 93_NS_INLINE void NS :: Condition :: signal () 94{ 95NS :: Object :: sendMessage < void > ( this , _NS_PRIVATE_SEL ( signal )) ; 96} 97 98//------------------------------------------------------------------------------------------------------------------------------------------------------------- 99 100_NS_INLINE void NS :: Condition :: broadcast () 101{ 102NS :: Object :: sendMessage < void > ( this , _NS_PRIVATE_SEL ( broadcast )) ; 103} 104 105//-------------------------------------------------------------------------------------------------------------------------------------------------------------