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


C++ Mutex::Release方法代码示例

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


在下文中一共展示了Mutex::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckForDeadSockets

void LogonServer::CheckForDeadSockets()
{
	_authSocketLock.Acquire();
	time_t t = time(NULL);
	time_t diff;
	set<AuthSocket*>::iterator itr = _authSockets.begin();
	set<AuthSocket*>::iterator it2;
	AuthSocket * s;

	for(itr = _authSockets.begin(); itr != _authSockets.end();)
	{
		it2 = itr;
		s = (*it2);
		++itr;

		diff = t - s->GetLastRecv();
		if(diff > 240) // More than 4mins -> kill the socket.
		{
			_authSockets.erase(it2);
			s->removedFromSet = true;
			s->Disconnect();
		}
	}
	_authSocketLock.Release();
}
开发者ID:arcticdev,项目名称:arctic-test,代码行数:25,代码来源:Main.cpp

示例2: DeactivateTile

void CCollideInterface::DeactivateTile(uint32 mapId, uint32 tileX, uint32 tileY)
{
	VMAP::IVMapManager* mgr = VMAP::VMapFactory::createOrGetVMapManager();
	m_loadLock.Acquire();
	if(!(--m_tilesLoaded[mapId][tileX][tileY]))
	{
		mgr->unloadMap(mapId, tileX, tileY);

		NavMeshData* nav = GetNavMesh(mapId);

		if(nav != NULL)
		{
			uint32 key = tileX | (tileY << 16);
			nav->tilelock.Acquire();
			std::map<uint32, dtTileRef>::iterator itr = nav->tilerefs.find(key);

			if(itr != nav->tilerefs.end())
			{
				nav->mesh->removeTile(itr->second, NULL, NULL);
				nav->tilerefs.erase(itr);
			}

			nav->tilelock.Release();
		}
	}

	m_loadLock.Release();
}
开发者ID:Selenah,项目名称:ArcEmu,代码行数:28,代码来源:CollideInterface.cpp

示例3: StartJumpEvent

//when player pushes gossip menu to start event
void StartJumpEvent(Player *Plr, uint64 NPCGUID)
{
	CreateLock.Acquire();
	//check if this player already has an ongoing jump event
	uint64 PlayerGUID = Plr->GetGUID();
	uint32 stampnow = GetTickCount();
	for( uint32 i=0;i<MAX_NUMBER_OF_CONCURENT_JUMP_EVENT_HOLDERS;i++)
		if( JumpEventHolders[i].PlayerGUID == PlayerGUID 
			&& stampnow < JumpEventHolders[i].EventExpireStamp
			)
		{
			Plr->BroadcastMessage("You are already participating in a Jump Event. Close that one");
			CreateLock.Release();
			return;
		}
	//check if NPC already is busy with someone
	int32 NPC_slot = -1;
	for( uint32 i=0;i<MAX_NUMBER_OF_CONCURENT_JUMP_EVENT_HOLDERS;i++)
		if( JumpEventHolders[i].SupervizorNPC == NPCGUID )
		{
			if( stampnow < JumpEventHolders[i].EventExpireStamp	)
			{
				Plr->BroadcastMessage("This NPC seems to be busy with someone. Strange.");
				CreateLock.Release();
				return;
			}
			NPC_slot = i;
		}
	//sanity check
	if( NPC_slot == -1 )
	{
		Plr->BroadcastMessage("Omg Bug.Shoot a developer pls and wait a server crash to refresh list");
		CreateLock.Release();
		return;
	}
	//ocupy this slot
	JumpEventHolders[ NPC_slot ].PlayerGUID = PlayerGUID;
	JumpEventHolders[ NPC_slot ].EventExpireStamp = MAX_EVENT_DURATION + stampnow;
	JumpEventHolders[ NPC_slot ].EventState = JES_WAITING_TO_START;
	CreateLock.Release();
	//start timer player side also
	uint32 estimated_time = Plr->getLevel() * 10;
	WorldPacket data(SMSG_START_MIRROR_TIMER, 20);
	data << uint32( TIMER_EXHAUSTION ) << estimated_time << estimated_time << int32(-1) << uint32(0);
	Plr->GetSession()->SendPacket(&data);
	//rest will be done by the supervizor AI : generate pads, spawn them 1 by 1, monitor progress
}
开发者ID:AtVirus,项目名称:Descent-Scripts,代码行数:48,代码来源:Globals.cpp

示例4: DeactivateTile

void CCollideInterface::DeactivateTile(uint32 mapId, uint32 tileX, uint32 tileY)
{
	m_loadLock.Acquire();
	if(!(--m_tilesLoaded[mapId][tileX][tileY]))
		CollisionMgr->unloadMap(mapId, tileY, tileX);

	m_loadLock.Release();
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:8,代码来源:CollideInterface.cpp

示例5: GenerateRequestId

 uint32 GenerateRequestId()
 {
     uint32 n;
     authmgrlock.Acquire();
     n = highrequestid++;
     authmgrlock.Release();
     return n;
 }
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:8,代码来源:ConsoleListener.cpp

示例6: ActivateTile

void CCollideInterface::ActivateTile(uint32 mapId, uint32 tileX, uint32 tileY)
{
	m_loadLock.Acquire();
	if(m_tilesLoaded[mapId][tileX][tileY] == 0)
		CollisionMgr->loadMap(sWorld.vMapPath.c_str(), mapId, tileY, tileX);

	++m_tilesLoaded[mapId][tileX][tileY];
	m_loadLock.Release();
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:9,代码来源:CollideInterface.cpp

示例7: LoadConfSettings

void Channel::LoadConfSettings()
{
	string BannedChannels = Config.MainConfig.GetStringDefault("Channels", "BannedChannels", "");
	string MinimumLevel = Config.MainConfig.GetStringDefault("Channels", "MinimumLevel", "");
	m_confSettingLock.Acquire();
	m_bannedChannels = StrSplit(BannedChannels, ";");
	m_minimumChannel = StrSplit(MinimumLevel, ";");
	m_confSettingLock.Release();
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:9,代码来源:Channel.cpp

示例8: SetRequest

 void SetRequest(uint32 id, ConsoleSocket * sock)
 {
     authmgrlock.Acquire();
     if( sock == NULL )
         requestmap.erase(id);
     else
         requestmap.insert(make_pair(id, sock));
     authmgrlock.Release();
 }
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:9,代码来源:ConsoleListener.cpp

示例9: DeactivateTile

void CCollideInterface::DeactivateTile(uint32 mapId, uint32 tileX, uint32 tileY)
{
	m_loadLock.Acquire();
	if(!(--m_tilesLoaded[mapId][tileX][tileY]))
	{
		COLLISION_BEGINTIMER;
		CollisionMgr->unloadMap(mapId, tileY, tileX);
		LOG_DEBUG("[%u ns] collision_deactivate_cell %u %u %u", c_GetNanoSeconds(c_GetTimerValue(), v1), mapId, tileX, tileY);
	}

	m_loadLock.Release();
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:12,代码来源:CollideInterface.cpp

示例10: GetRequest

 ConsoleSocket * GetRequest(uint32 id)
 {
     ConsoleSocket* rtn;
     authmgrlock.Acquire();
     map<uint32,ConsoleSocket*>::iterator itr = requestmap.find(id);
     if(itr == requestmap.end())
         rtn = NULL;
     else
         rtn = itr->second;
     authmgrlock.Release();
     return rtn;
 }
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:12,代码来源:ConsoleListener.cpp

示例11: ActivateTile

void CCollideInterface::ActivateTile(uint32 mapId, uint32 tileX, uint32 tileY)
{
	VMAP::IVMapManager* mgr = VMAP::VMapFactory::createOrGetVMapManager();
	m_loadLock.Acquire();
	if(m_tilesLoaded[mapId][tileX][tileY] == 0)
	{
		mgr->loadMap(sWorld.vMapPath.c_str(), mapId, tileX, tileY);
		LoadNavMeshTile(mapId, tileX, tileY);
	}
	++m_tilesLoaded[mapId][tileX][tileY];
	m_loadLock.Release();
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:12,代码来源:CollideInterface.cpp

示例12: fflush

Tracer::~Tracer()
{
    if (s_logfile)
    {
	fflush(s_logfile);
#if HAVE_FSYNC
	fsync(fileno(s_logfile));
#endif
    }

    fflush(stdout);

    s_trace_mutex.Release();
}
开发者ID:pdh11,项目名称:chorale,代码行数:14,代码来源:trace.cpp

示例13: DeactivateMap

void CCollideInterface::DeactivateMap(uint32 mapId)
{
	if( !CollisionMgr ) return;
	m_mapCreateLock.Acquire();
	ASSERT(m_mapLocks[mapId] != NULL);
	--m_mapLocks[mapId]->m_loadCount;
	if( m_mapLocks[mapId]->m_loadCount == 0 )
	{
		// no instances using this anymore
		delete m_mapLocks[mapId];
		CollisionMgr->unloadMap(mapId);
		m_mapLocks[mapId] = NULL;
	}
	m_mapCreateLock.Release();
}
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:15,代码来源:CollideInterface.cpp

示例14: GetCreateChannel

Channel* ChannelMgr::GetCreateChannel(const char* name, Player* p, uint32 type_id)
{
	ChannelList::iterator itr;
	ChannelList* cl = &Channels[0];
	Channel* chn;
	if(seperatechannels && p != NULL && stricmp(name, sWorld.getGmClientChannel().c_str()))
		cl = &Channels[p->GetTeam()];

	lock.Acquire();
	for(itr = cl->begin(); itr != cl->end(); ++itr)
	{
		if(!stricmp(name, itr->first.c_str()))
		{
			lock.Release();
			return itr->second;
		}
	}

	// make sure the name isn't banned
	m_confSettingLock.Acquire();
	for(vector<string>::iterator itr2 = m_bannedChannels.begin(); itr2 != m_bannedChannels.end(); ++itr2)
	{
		if(!strnicmp(name, itr2->c_str(), itr2->size()))
		{
			lock.Release();
			m_confSettingLock.Release();
			return NULL;
		}
	}

	chn = new Channel(name, (seperatechannels && p != NULL) ? p->GetTeam() : 0, type_id);
	m_confSettingLock.Release();//Channel::Channel() reads configs so we release the lock after we create the Channel.
	cl->insert(make_pair(chn->m_name, chn));
	lock.Release();
	return chn;
}
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:36,代码来源:Channel.cpp

示例15: ActivateMap

void CCollideInterface::ActivateMap(uint32 mapId)
{
	if( !CollisionMgr ) return;
	m_mapCreateLock.Acquire();
	if( m_mapLocks[mapId] == NULL )
	{
		m_mapLocks[mapId] = new CollisionMap;
		m_mapLocks[mapId]->m_loadCount = 1;
		memset(m_mapLocks[mapId]->m_tileLoadCount, 0, sizeof(uint32)*64*64);
	}
	else
		m_mapLocks[mapId]->m_loadCount++;

	m_mapCreateLock.Release();
}
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:15,代码来源:CollideInterface.cpp


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