当前位置: 首页>>代码示例>>C++>>正文


C++ CMutex::Enter方法代码示例

本文整理汇总了C++中CMutex::Enter方法的典型用法代码示例。如果您正苦于以下问题:C++ CMutex::Enter方法的具体用法?C++ CMutex::Enter怎么用?C++ CMutex::Enter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMutex的用法示例。


在下文中一共展示了CMutex::Enter方法的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;
	}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例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;
}
开发者ID:nightstyles,项目名称:focp,代码行数:7,代码来源:File.cpp

示例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;
}
开发者ID:nightstyles,项目名称:focp,代码行数:7,代码来源:File.cpp

示例4: ServiceSuspend

/// Breaks the service. This is provided for the unit tests only to simulate a broken JVM or service and
/// test the recovery mechanism. Do not call it intentionally otherwise.
void ServiceSuspend () {
	_ReportStateStopping ();
	g_oMutex.Enter ();
	g_poPipe->Close ();
	// Never leave the critical section - this function is designed specifically to fcuk up the
	// execution of the service to test a hung JVM. IT IS NOT THE WINDOWS SERVICE SUSPEND/RESUME.
}
开发者ID:gsteri1,项目名称:OG-Platform,代码行数:9,代码来源:Service.cpp

示例5:

CAcmUdp::~CAcmUdp()
{
	if(m_bRegistered)
	{
		g_oMutex.Enter();
		g_oUdpTable.Remove(m_nDomain);
		g_oMutex.Leave();
	}
}
开发者ID:nightstyles,项目名称:focp,代码行数:9,代码来源:AcmUdp.cpp

示例6: 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 ();
	}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例7: 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 ();
}
开发者ID:gsteri1,项目名称:OG-Platform,代码行数:14,代码来源:Service.cpp

示例8:

/// 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;
}
开发者ID:arunaryan,项目名称:OG-RStats,代码行数:13,代码来源:FudgeMsgMap.cpp

示例9: 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;
}
开发者ID:nightstyles,项目名称:focp,代码行数:10,代码来源:AcmUdp.cpp

示例10: 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;
}
开发者ID:arunaryan,项目名称:OG-RStats,代码行数:13,代码来源:FudgeMsgMap.cpp

示例11: 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;
}
开发者ID:nightstyles,项目名称:focp,代码行数:11,代码来源:MdbApi.cpp

示例12: 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();
}
开发者ID:nightstyles,项目名称:focp,代码行数:12,代码来源:MdbApi.cpp

示例13: 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();
		}
	}
开发者ID:nightstyles,项目名称:focp,代码行数:12,代码来源:DynamicLibrary.cpp

示例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 ();
}
开发者ID:arunaryan,项目名称:OG-RStats,代码行数:15,代码来源:FudgeMsgMap.cpp

示例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();
}
开发者ID:nightstyles,项目名称:focp,代码行数:14,代码来源:AcmUdp.cpp


注:本文中的CMutex::Enter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。