Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Aborting by using CEvent and CMultiLock
CConvertLock::CConvertLock(CSyncObject* pSyncAbort, CSyncObject* pSyncObj) :
m_pLock(NULL)
{
m_SyncObj[0] = pSyncAbort;
m_SyncObj[1] = pSyncObj;
m_pLock = new CMultiLock(m_SyncObj, 2);
}
CConvertLock::~CConvertLock()
{
delete m_pLock;
}
DWORD CConvertLock::Lock()
{
DWORD ret;
ret = m_pLock->Lock(INFINITE, FALSE);
if (m_pLock->IsLocked(0) != FALSE) {
throw CConvert::EConvertError::EAbort;
}
return ret;
}
DWORD CConvertLock::Unlock() {
return m_pLock->Unlock();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.