本文整理汇总了C++中SpinLock::Unlock方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinLock::Unlock方法的具体用法?C++ SpinLock::Unlock怎么用?C++ SpinLock::Unlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinLock
的用法示例。
在下文中一共展示了SpinLock::Unlock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
void NetworkManager::Run()
{
int threadId;
struct epoll_event events[100];
int numOfEvent, n;
g_networkThreadCountLock.Lock();
threadId = g_networkThreadCount++;
g_networkThreadCountLock.Unlock();
for(;;)
{
numOfEvent = epoll_wait(m_epollFdList[threadId], m_epollEvent2DList[threadId], 100, 2000);
//printf("NW thread %d\n", threadId);
if(numOfEvent < 0){
// critical error
fprintf(stderr, "[ERROR] epoll_wait() ERROR : %s\n", strerror(errno));
exit(1);
}
if(numOfEvent == 0)
{
continue;
}
//printf("NT %d activated\n", TC);
OnEvent(numOfEvent, threadId);
}
close(m_serverFd);
for(int i=0; i<NETWORK_THREAD_NUM; i++)
close(m_epollFdList[i]);
}
示例2: SingletonReleaseTextVector
void SingletonReleaseTextVector()
{
g_SpinLockTextVec.Lock();
if (g_pTextVec)
{
delete g_pTextVec;
g_pTextVec = 0;
}
g_SpinLockTextVec.Unlock();
}
示例3: SingletonReleaseHashTable
void SingletonReleaseHashTable()
{
g_SpinLockHashTable.Lock();
if (g_pObjHash)
{
delete g_pObjHash;
g_pObjHash = 0;
}
g_SpinLockHashTable.Unlock();
}
示例4: SingletonGetHashTable
HashType * SingletonGetHashTable()
{
if (!g_pObjHash)
{
g_SpinLockHashTable.Lock();
if (!g_pObjHash)
g_pObjHash = new HashType;
g_SpinLockHashTable.Unlock();
}
return g_pObjHash;
}
示例5: SingletonGetTextVector
TextBufVecType * SingletonGetTextVector()
{
if (!g_pTextVec)
{
g_SpinLockTextVec.Lock();
if (!g_pTextVec)
g_pTextVec = new TextBufVecType;
g_SpinLockTextVec.Unlock();
}
return g_pTextVec;
}