Various small fixes and improvements
This commit is contained in:
@@ -26,7 +26,7 @@ public:
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Win32ConditionVariable"/> class.
|
||||
/// </summary>
|
||||
Win32ConditionVariable()
|
||||
__forceinline Win32ConditionVariable()
|
||||
{
|
||||
Windows::InitializeConditionVariable(&_cond);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/// Blocks the current thread execution until the condition variable is woken up.
|
||||
/// </summary>
|
||||
/// <param name="lock">The critical section locked by the current thread.</param>
|
||||
void Wait(const Win32CriticalSection& lock)
|
||||
__forceinline void Wait(const Win32CriticalSection& lock)
|
||||
{
|
||||
Windows::SleepConditionVariableCS(&_cond, &lock._criticalSection, 0xFFFFFFFF);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/// <param name="lock">The critical section locked by the current thread.</param>
|
||||
/// <param name="timeout">The time-out interval, in milliseconds. If the time-out interval elapses, the function re-acquires the critical section and returns zero. If timeout is zero, the function tests the states of the specified objects and returns immediately. If timeout is INFINITE, the function's time-out interval never elapses.</param>
|
||||
/// <returns>If the function succeeds, the return value is true, otherwise, if the function fails or the time-out interval elapses, the return value is false.</returns>
|
||||
bool Wait(const Win32CriticalSection& lock, const int32 timeout)
|
||||
__forceinline bool Wait(const Win32CriticalSection& lock, const int32 timeout)
|
||||
{
|
||||
return !!Windows::SleepConditionVariableCS(&_cond, &lock._criticalSection, timeout);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
/// <summary>
|
||||
/// Notifies one waiting thread.
|
||||
/// </summary>
|
||||
void NotifyOne()
|
||||
__forceinline void NotifyOne()
|
||||
{
|
||||
Windows::WakeConditionVariable(&_cond);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
/// <summary>
|
||||
/// Notifies all waiting threads.
|
||||
/// </summary>
|
||||
void NotifyAll()
|
||||
__forceinline void NotifyAll()
|
||||
{
|
||||
Windows::WakeAllConditionVariable(&_cond);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Win32CriticalSection"/> class.
|
||||
/// </summary>
|
||||
Win32CriticalSection()
|
||||
__forceinline Win32CriticalSection()
|
||||
{
|
||||
Windows::InitializeCriticalSectionEx(&_criticalSection, 4000, 0x01000000);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="Win32CriticalSection"/> class.
|
||||
/// </summary>
|
||||
~Win32CriticalSection()
|
||||
__forceinline ~Win32CriticalSection()
|
||||
{
|
||||
Windows::DeleteCriticalSection(&_criticalSection);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
/// <summary>
|
||||
/// Locks the critical section.
|
||||
/// </summary>
|
||||
void Lock() const
|
||||
__forceinline void Lock() const
|
||||
{
|
||||
Windows::EnterCriticalSection(&_criticalSection);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
/// Attempts to enter a critical section without blocking. If the call is successful, the calling thread takes ownership of the critical section.
|
||||
/// </summary>
|
||||
/// <returns>True if calling thread took ownership of the critical section.</returns>
|
||||
bool TryLock() const
|
||||
__forceinline bool TryLock() const
|
||||
{
|
||||
return Windows::TryEnterCriticalSection(&_criticalSection) != 0;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
/// <summary>
|
||||
/// Releases the lock on the critical section.
|
||||
/// </summary>
|
||||
void Unlock() const
|
||||
__forceinline void Unlock() const
|
||||
{
|
||||
Windows::LeaveCriticalSection(&_criticalSection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user