本文整理汇总了C++中CMutex::Leave方法的典型用法代码示例。如果您正苦于以下问题:C++ CMutex::Leave方法的具体用法?C++ CMutex::Leave怎么用?C++ CMutex::Leave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMutex
的用法示例。
在下文中一共展示了CMutex::Leave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendHeartbeat
bool SendHeartbeat (bool bWithStash) {
LOGDEBUG (TEXT ("Sending heartbeat message"));
FudgeStatus status;
FudgeMsg msg;
if ((status = FudgeMsg_create (&msg)) != FUDGE_OK) {
LOGFATAL (TEXT ("Couldn't create message, status ") << status);
assert (0);
return false;
}
if ((status = ConnectorMessage_setOperation (msg, HEARTBEAT)) != FUDGE_OK) {
FudgeMsg_release (msg);
LOGFATAL (TEXT ("Couldn't create message, status ") << status);
assert (0);
return false;
}
if (bWithStash) {
m_oStashMutex.Enter ();
if (m_msgStash) {
if ((status = ConnectorMessage_setStash (msg, m_msgStash)) != FUDGE_OK) {
LOGFATAL (TEXT ("Couldn't create message, status ") << status);
assert (0);
status = FUDGE_OK;
// Not good, but can carry on
}
}
m_oStashMutex.Leave ();
}
bool bResult = m_poService->Send (MESSAGE_DIRECTIVES_CLIENT, msg);
FudgeMsg_release (msg);
return bResult;
}
示例2: PrintErrorV
AFS_API int32 PrintErrorV(const char* sFormat, CVaList& pArgList)
{
g_oStdOutMutex.Enter();
int32 nRet = CSingleInstance<CStdErrFormatter>::GetInstance()->oFormatter.PrintV(sFormat, pArgList);
g_oStdOutMutex.Leave();
return nRet;
}
示例3: ScanV
AFS_API int32 ScanV(const char* sFormat, CVaList& pArgList)
{
g_oStdInMutex.Enter();
int32 nRet = CSingleInstance<CStdInFormatter>::GetInstance()->oFormatter.ScanV(sFormat, pArgList);
g_oStdInMutex.Leave();
return nRet;
}
示例4:
CAcmUdp::~CAcmUdp()
{
if(m_bRegistered)
{
g_oMutex.Enter();
g_oUdpTable.Remove(m_nDomain);
g_oMutex.Leave();
}
}
示例5: SetStash
void SetStash (FudgeMsg msgStash) {
m_oStashMutex.Enter ();
if (m_msgStash) {
LOGDEBUG (TEXT ("Discarding old stash message"));
FudgeMsg_release (m_msgStash);
}
FudgeMsg_retain (msgStash);
m_msgStash = msgStash;
m_oStashMutex.Leave ();
}
示例6: ServiceStop
/// Attempts to stop the service.
///
/// @param[in] bForce TRUE to stop the service immediately by closing the IPC, FALSE to initiate a
/// lazy close when the IPC goes idle.
void ServiceStop (bool bForce) {
g_oMutex.Enter ();
if (bForce) {
_ReportStateStopping ();
g_poPipe->Close ();
} else {
g_poPipe->LazyClose ();
}
g_oMutex.Leave ();
}
示例7:
/// Returns the binary encoding of the message.
///
/// @return the encoding
const void *CFudgeMsgInfo::GetData () {
if (!m_pData) {
g_oMutex.Enter ();
if (!m_pData) {
m_pData = _EncodeFudgeMsg (m_msg, &m_cbData);
}
g_oMutex.Leave ();
}
return m_pData;
}
示例8: QueryUdp
CAcmUdp* CAcmUdp::QueryUdp(uint32 nDomain)
{
CAcmUdp* pUdp = NULL;
g_oMutex.Enter();
CRbTreeNode* pIt = g_oUdpTable.Find(nDomain);
if(pIt != g_oUdpTable.End())
pUdp = g_oUdpTable.GetItem(pIt);
g_oMutex.Leave();
return pUdp;
}
示例9: GetLength
/// Returns the length of the binary encoding of the message in bytes.
///
/// @return the length if bytes
size_t CFudgeMsgInfo::GetLength () {
if (!m_pData) {
g_oMutex.Enter ();
if (!m_pData) {
m_pData = _EncodeFudgeMsg (m_msg, &m_cbData);
}
g_oMutex.Leave ();
}
return m_cbData;
}
示例10: GetMdb
CMdb* CMdb::GetMdb(const char* sDbName)
{
CMdb* pDb = NULL;
CRbTreeNode* pEnd = m_oMdbTable.End();
g_oMdbMutex.Enter();
CRbTreeNode* pIt = m_oMdbTable.Find(sDbName);
if(pIt != pEnd)
pDb = m_oMdbTable.GetItem(pIt);
g_oMdbMutex.Leave();
return pDb;
}
示例11: CFudgeMsgInfo
/// Finds an existing message entry in the map, or creates a new entry if none is found.
/// The message is returned with an incremented reference count - the caller should call
/// Release when finished with it (unless the reference is offloaded to R).
///
/// @param[in] the message to look up
/// @return the message entry
CFudgeMsgInfo *CFudgeMsgInfo::GetMessage (FudgeMsg msg) {
CFudgeMsgInfo *poMessage;
g_oMutex.Enter ();
TFudgeMsgMap::const_iterator itr = g_oMap.find (msg);
if (itr != g_oMap.end ()) {
poMessage = itr->second;
poMessage->m_nRefCount++;
g_oMutex.Leave ();
return poMessage;
}
poMessage = new CFudgeMsgInfo (msg, NULL, 0);
if (poMessage) {
LOGDEBUG (TEXT ("Adding message to map (size = ") << (g_oMap.size () + 1) << TEXT (")"));
g_oMap.insert (TFudgeMsgMap::value_type (msg, poMessage));
g_cbData += MESSAGE_INFO_OVERHEAD;
} else {
LOGFATAL (TEXT ("Out of memory"));
}
g_oMutex.Leave ();
return poMessage;
}
示例12: UnLoad
void UnLoad(CShareLibrary* pLib)
{
if(pLib)
{
CRbTreeNode* pEnd = m_oLibs.End();
m_oMutex.Enter();
CRbTreeNode* pIt = m_oLibs.Find(pLib->GetFileName());
if( (pIt != pEnd) && (pLib == m_oLibs.GetItem(pIt)) && pLib->Release())
m_oLibs.Remove(pIt);
m_oMutex.Leave();
}
}
示例13: RemoveAll
void CMdb::RemoveAll()
{
RemoveAccessTable();
g_oMdbMutex.Enter();
while(m_oMdbTable.GetSize())
{
CRbTreeNode* pIt = m_oMdbTable.First();
CMdb* pDb = m_oMdbTable.GetItem(pIt);
delete pDb;
}
g_oMdbMutex.Leave();
}
示例14: Release
/// Decrements the R reference count, destroying the object when the count reaches zero.
void CFudgeMsgInfo::Release (CFudgeMsgInfo *poMessage) {
g_oMutex.Enter ();
LOGDEBUG (TEXT ("Releasing CFudgeMsgInfo, rc=") << poMessage->m_nRefCount);
if (--poMessage->m_nRefCount == 0) {
TFudgeMsgMap::iterator itr = g_oMap.find (poMessage->m_msg);
if (itr != g_oMap.end ()) {
LOGDEBUG (TEXT ("Removing message from map (size = ") << (g_oMap.size () - 1) << TEXT (")"));
g_oMap.erase (itr);
g_cbData -= MESSAGE_INFO_OVERHEAD;
}
delete poMessage;
}
g_oMutex.Leave ();
}
示例15: GetAllDomains
void CAcmUdp::GetAllDomains(CVector<uint32> &oDomains)
{
oDomains.Clear();
CRbTreeNode* pEnd = g_oUdpTable.End();
g_oMutex.Enter();
CRbTreeNode* pIt = g_oUdpTable.First();
for(uint32 nIdx=0; pIt!=pEnd; pIt=g_oUdpTable.GetNext(pIt))
{
uint32 nDomain = g_oUdpTable.GetKey(pIt);
oDomains.Insert(nIdx, nDomain);
++nIdx;
}
g_oMutex.Leave();
}