⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmonitor.cpp

📁 <B>DirectX9.0 3D游戏编程</B>
💻 CPP
字号:
/*******************************************************************
 *         Advanced 3D Game Programming using DirectX 9.0
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * copyright (c) 2003 by Peter A Walsh and Adrian Perez
 * See license.txt for modification and distribution information
 ******************************************************************/
// cMonitor.cpp: implementation of the cMonitor class.
//
//////////////////////////////////////////////////////////////////////

#include "cMonitor.h"
#include "cNetError.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

cMonitor::cMonitor()
{
  // This mutex will help the two threads share their toys.
  d_mutex = CreateMutex( NULL, false, NULL );
  if( d_mutex == NULL )
    throw cNetError( "cMonitor() - Mutex creation failed." );
}

cMonitor::~cMonitor()
{
  if( d_mutex != NULL )
  {
    CloseHandle( d_mutex );
    d_mutex = NULL;
  }
}


void cMonitor::MutexOn() const
{
  WaitForSingleObject( d_mutex, INFINITE );  // To be safe...
}


void cMonitor::MutexOff() const
{
  ReleaseMutex( d_mutex );  // To be safe...
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -