intarray.cpp
来自「《Visual C++ 6.0实例教程》配套代码」· C++ 代码 · 共 47 行
CPP
47 行
// IntArray.cpp: implementation of the CIntArray class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ThreadTest.h"
#include "IntArray.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CIntArray::CIntArray()
{
}
CIntArray::~CIntArray()
{
}
void CIntArray::SetArray(int value)
{
criticalSection.Lock();
for (int x=0; x<10; ++x)
{
// ::Sleep(500);
array[x] = value;
}
criticalSection.Unlock();
}
void CIntArray::GetArray(int dstArray[10])
{
criticalSection.Lock();
for (int x=0; x<10; ++x)
dstArray[x] = array[x];
criticalSection.Unlock();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?