📄 producerthread.cpp
字号:
/************************************************************************
* 版权所有 (C)2003,windcao(曹建峰)
* 作 者: 曹建峰
* 完成日期: 2004年1月9日
* 修改日期 版本号 修改人 修改内容
************************************************************************/
// ProducerThread.cpp : implementation file
//
#include "stdafx.h"
#include "P_C.h"
#include "ProducerThread.h"
#include "P_CDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//#define CSM_BUF_COUNT 3000
#define MAX_DATA_COUNT 888888888
/////////////////////////////////////////////////////////////////////////////
// CProducerThread
IMPLEMENT_DYNCREATE(CProducerThread, CWinThread)
CProducerThread::CProducerThread(void* hParent)
:m_pParentDlg(hParent)
{
}
CProducerThread::CProducerThread()
{
}
CProducerThread::~CProducerThread()
{
}
BOOL CProducerThread::InitInstance()
{
// TODO: perform and per-thread initialization here
return TRUE;
}
int CProducerThread::ExitInstance()
{
// TODO: perform any per-thread cleanup here
return CWinThread::ExitInstance();
}
BEGIN_MESSAGE_MAP(CProducerThread, CWinThread)
//{{AFX_MSG_MAP(CProducerThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProducerThread message handlers
int CProducerThread::Run()
{
CP_CDlg *pDlg;
pDlg=(CP_CDlg*)m_pParentDlg;
CSingleLock mutexLock(pDlg->m_pMutex);
for(int i=0;i<MAX_DATA_COUNT;i++)
{
pDlg->m_pSemaphoreEmpty->Lock();
mutexLock.Lock();
pDlg->m_sBuf.Format("%0.10d",i);
mutexLock.Unlock();
pDlg->m_pSemaphoreFull->Unlock();
}
return CWinThread::Run();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -