Critical:临界的
Section:单元
CCriticalSection:临界区
示例:
CCriticalSection m_Lock;
=================================================
void CDlgState::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
//更新
UpdateEnergy();
CDialog::OnTimer(nIDEvent);
}
===========================================
void CDlgState::UpdateEnergy()//Energy:能量
{
if(m_pAudioCtrl)
{
m_Lock.Lock();
... ...//受保护的代码段
m_Lock.Unlock();
}
}
评论