📄 mutex_win32.cpp
字号:
/* $Id: mutex_win32.cpp,v 1.4 2003/07/20 22:30:53 grumbel Exp $
**
** ClanLib Game SDK
** Copyright (C) 2003 The ClanLib Team
** For a total list of contributers see the file CREDITS.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
*/
#include "Core/precomp.h"
#include "mutex_win32.h"
/////////////////////////////////////////////////////////////////////////////
// CL_Mutex 0.4 backward compatibility
CL_Mutex *CL_Mutex::create()
{
return new CL_Mutex;
}
/////////////////////////////////////////////////////////////////////////////
// CL_Mutex win32 implementation
CL_Mutex::CL_Mutex()
: impl(new CL_Mutex_Generic)
{
InitializeCriticalSection(&impl->mutex);
impl->event = CreateEvent(NULL, FALSE, FALSE, NULL);
}
CL_Mutex::CL_Mutex(const CL_Mutex ©)
{
cl_assert(false);
}
void CL_Mutex::operator =(const CL_Mutex ©)
{
cl_assert(false);
}
CL_Mutex::~CL_Mutex()
{
DeleteCriticalSection(&impl->mutex);
CloseHandle(impl->event);
delete impl;
}
void CL_Mutex::enter()
{
EnterCriticalSection(&impl->mutex);
}
void CL_Mutex::leave()
{
LeaveCriticalSection(&impl->mutex);
}
void CL_Mutex::wait()
{
WaitForSingleObject(impl->event, INFINITE);
}
void CL_Mutex::notify()
{
SetEvent(impl->event);
}
void CL_Mutex::notify_all()
{
cl_assert(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -