Commit 217b2cd3 authored by sletz's avatar sletz
Browse files

Add JackWinCriticalSection class.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4748 0c269be4-1314-0410-8aa9-9f06e86f4224
parent b60b76de
......@@ -88,6 +88,24 @@ namespace Jack
{
return(ReleaseMutex(fMutex) != 0);
}
bool JackWinCriticalSection::Lock()
{
EnterCriticalSection(&fSection);
return true;
}
bool JackWinCriticalSection::Trylock()
{
return (TryEnterCriticalSection(&fSection));
}
bool JackWinCriticalSection::Unlock()
{
LeaveCriticalSection(&fSection);
return true;
}
} // namespace
......
......@@ -89,6 +89,31 @@ class SERVER_EXPORT JackWinMutex
};
class SERVER_EXPORT JackWinCriticalSection
{
protected:
LPCRITICAL_SECTION fSection;
public:
JackWinCriticalSection(const char* name = NULL)
{
InitializeCriticalSection(&fSection);
}
virtual ~JackWinCriticalSection()
{
DeleteCriticalSection(&fSection);
}
bool Lock();
bool Trylock();
bool Unlock();
};
} // namespace
......
......@@ -30,7 +30,8 @@ namespace Jack
\brief A synchronization primitive built using a condition variable.
*/
class JackWinProcessSync : public JackWinMutex
//class JackWinProcessSync : public JackWinMutex
class JackWinProcessSync : public JackWinCriticalSection
{
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment