本文整理汇总了C++中IsStopped函数的典型用法代码示例。如果您正苦于以下问题:C++ IsStopped函数的具体用法?C++ IsStopped怎么用?C++ IsStopped使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsStopped函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void ArticleCache::Run()
{
// automatically flush the cache if it is filled to 90% (only in DirectWrite mode)
size_t fillThreshold = (size_t)g_Options->GetArticleCache() * 1024 * 1024 / 100 * 90;
int resetCounter = 0;
bool justFlushed = false;
while (!IsStopped() || m_allocated > 0)
{
if ((justFlushed || resetCounter >= 1000 || IsStopped() ||
(g_Options->GetDirectWrite() && m_allocated >= fillThreshold)) &&
m_allocated > 0)
{
justFlushed = CheckFlush(m_allocated >= fillThreshold);
resetCounter = 0;
}
else if (!m_allocated)
{
Guard guard(m_allocMutex);
m_allocCond.Wait(m_allocMutex, [&]{ return IsStopped() || m_allocated > 0; });
resetCounter = 0;
}
else
{
Util::Sleep(5);
resetCounter += 5;
}
}
}
示例2: debug
void NntpServer::Run()
{
debug("Entering NntpServer-loop");
info("Listening on port %i", m_port);
#ifdef WIN32
if (m_speed > 0)
{
timeBeginPeriod(1);
}
#endif
int num = 1;
while (!IsStopped())
{
bool bind = true;
if (!m_connection)
{
m_connection = std::make_unique<Connection>(m_host, m_port, m_secureCert);
m_connection->SetTimeout(10);
m_connection->SetSuppressErrors(false);
bind = m_connection->Bind();
}
// Accept connections and store the new Connection
std::unique_ptr<Connection> acceptedConnection;
if (bind)
{
acceptedConnection = m_connection->Accept();
}
if (!bind || !acceptedConnection)
{
// Server could not bind or accept connection, waiting 1/2 sec and try again
if (IsStopped())
{
break;
}
m_connection.reset();
usleep(500 * 1000);
continue;
}
NntpProcessor* commandThread = new NntpProcessor(num++, m_id, m_dataDir,
m_cacheDir, m_secureCert, m_secureKey, m_latency, m_speed, m_cache);
commandThread->SetAutoDestroy(true);
commandThread->SetConnection(std::move(acceptedConnection));
commandThread->Start();
}
if (m_connection)
{
m_connection->Disconnect();
}
debug("Exiting NntpServer-loop");
}
示例3: ChangeMoveType
void CSoldierBase::MoveCommon()
{
//目標地点へ移動(中腰)
if( m_sTargetPosition < m_sPositionX ) //+800
{
m_sMoveX = -4;
m_sDir = DIR_LEFT;
if( IsStopped() && IsLanding() )
{
// if( pGame->pBg->get_kabetype(m_pObj->pos.x/100-0*1,m_pObj->pos.y/100) == 0
// && viiSub::IsGroundBlock(m_pObj->pos.x/100-0*1,m_pObj->pos.y/100) )
if( pGame->pBg->get_kabetype(m_pObj->pos.x/100-1*1,m_pObj->pos.y/100-8*0) == 1
&& pGame->pBg->get_kabetype(m_pObj->pos.x/100-1*1,m_pObj->pos.y/100-8*1) == 1
&& pGame->pBg->get_kabetype(m_pObj->pos.x/100-1*1,m_pObj->pos.y/100-8*2) == 0 )
{
//壁がなければジャンプさせる
ChangeMoveType( enMoveTypeClimb );
//SetJump();
}
}
}
else if( m_sTargetPosition > m_sPositionX ) //-800
{
m_sMoveX = +4;
m_sDir = DIR_RIGHT;
if( IsStopped() && IsLanding() )
{
// if( pGame->pBg->get_kabetype(m_pObj->pos.x/100+8*1,m_pObj->pos.y/100-16) == 0
// && viiSub::IsGroundBlock(m_pObj->pos.x/100+8*1,m_pObj->pos.y/100) )
if( pGame->pBg->get_kabetype(m_pObj->pos.x/100+1*1,m_pObj->pos.y/100-8*0) == 1
&& pGame->pBg->get_kabetype(m_pObj->pos.x/100+1*1,m_pObj->pos.y/100-8*1) == 1
&& pGame->pBg->get_kabetype(m_pObj->pos.x/100+1*1,m_pObj->pos.y/100-8*2) == 0)
{
//壁がなければジャンプさせる
ChangeMoveType( enMoveTypeClimb );
// SetJump();
}
}
}
else
{
m_sMoveX = 0;
if( MoveSpeedDecrement() )
{
ChangeMoveType( enMoveTypeWait );
}
}
}
示例4: while
void WINAPI CTNTServer::OnReceive(const CONNECTION_ID& Connection,
const LPVOID pData,
const DWORD dwDataLen)
{
CFixBuffer& InputStream = m_mapPeers[Connection.m_Socket].m_InputStream;
InputStream.Put(pData, dwDataLen);
while(true)
{
// is there a room for MsgSize?
if(InputStream.GetLength() < MESSAGE_HEADER_SIZE)
return;
CString strSize;
char* pSizeString = strSize.GetBufferSetLength(4);
memcpy(pSizeString,((char*)InputStream.GetData() + sizeof(char)*25),3);
pSizeString[3]=0;
strSize.ReleaseBuffer();
DWORD dwSize = (DWORD)atol(strSize);
// is there a room for Msg?
if(InputStream.GetLength() < dwSize)
return;
for(COMMANDS_TYPE::iterator index = m_ValidIncomingCommands.begin(); index != m_ValidIncomingCommands.end(); index++)
{
CMMHHMessage* pitem= *index;
if(pitem->Parse(InputStream) == ERROR_SUCCESS)
{
CMessageItem Item;
if(IsStopped())
break;
Item.m_pMessage = pitem->GetNewCopy();
TMapPeers::iterator it = m_mapPeers.find(Connection.m_Socket);
if(it == m_mapPeers.end())
{
ATLASSERT(false);
return;
}
Item.m_Client = it->first;
m_queIncoming.Push(Item);
break;
}
}
if(IsStopped())
return;
}
}
示例5: while
void ChildWatchDog::Run()
{
static const int WAIT_SECONDS = 60;
time_t start = Util::CurrentTime();
while (!IsStopped() && (Util::CurrentTime() - start) < WAIT_SECONDS)
{
Util::Sleep(10);
}
if (!IsStopped())
{
info("Restarting hanging child process for %s", *m_infoName);
kill(m_processId, SIGKILL);
}
}
示例6: time
void ChildWatchDog::Run()
{
static const int WAIT_SECONDS = 60;
time_t tStart = time(NULL);
while (!IsStopped() && (time(NULL) - tStart) < WAIT_SECONDS)
{
usleep(10 * 1000);
}
if (!IsStopped())
{
info("Restarting hanging child process");
kill(m_hProcessID, SIGKILL);
}
}
示例7: debug
void UrlCoordinator::Run()
{
debug("Entering UrlCoordinator-loop");
while (!DownloadQueue::IsLoaded())
{
usleep(20 * 1000);
}
int resetCounter = 0;
while (!IsStopped())
{
bool downloadStarted = false;
if (!g_Options->GetPauseDownload() || g_Options->GetUrlForce())
{
// start download for next URL
GuardedDownloadQueue downloadQueue = DownloadQueue::Guard();
if ((int)m_activeDownloads.size() < g_Options->GetUrlConnections())
{
NzbInfo* nzbInfo = GetNextUrl(downloadQueue);
bool hasMoreUrls = nzbInfo != nullptr;
bool urlDownloadsRunning = !m_activeDownloads.empty();
m_hasMoreJobs = hasMoreUrls || urlDownloadsRunning;
if (hasMoreUrls && !IsStopped())
{
StartUrlDownload(nzbInfo);
downloadStarted = true;
}
}
}
int sleepInterval = downloadStarted ? 0 : 100;
usleep(sleepInterval * 1000);
resetCounter += sleepInterval;
if (resetCounter >= 1000)
{
// this code should not be called too often, once per second is OK
ResetHangingDownloads();
resetCounter = 0;
}
}
WaitJobs();
debug("Exiting UrlCoordinator-loop");
}
示例8: ISetFault
uint32_t plLayerMovie::Eval(double wSecs, uint32_t frame, uint32_t ignore)
{
uint32_t dirty = plLayerAnimation::Eval(wSecs, frame, ignore);
if( !IGetFault() && !(ignore & kTexture) )
{
if( ICurrentFrameDirty(wSecs) )
{
if( IGetCurrentFrame() )
ISetFault("Getting current frame");
if( GetTexture() )
{
hsGDeviceRef* ref = GetTexture()->GetDeviceRef();
if( ref )
ref->SetDirty(true);
}
}
else
if( IsStopped() )
{
IMovieIsIdle();
}
dirty |= kTexture;
}
return dirty;
}
示例9: while
void TestCommonData::Wait( bool& work, bool& done)
{
work = false;
done = false;
bool started = false;
while( !done || !started )
{
if (work)
started = true;
UpdateData();
if ( IsStopped() )
{
mCommand.Start_Oper = false;
mCommand.Stop_Oper = true;
mCommand.Nasos_M2 = app::Settings::Instance().MainPupm() == "M2";
mCommand.OP15_25_Continum = false;
mCommand.Next_Amp = false;
mCommand.Write();
Log( "Испытание прервано" );
return;
}
}
TestingTime = StartTime.elapsed()/1000;
*mStopMarker = !CheckErrors();
}
示例10: debug
void ServiceCoordinator::Run()
{
debug("Entering ServiceCoordinator-loop");
const int iStepMSec = 100;
int iCurTick = 0;
while (!IsStopped())
{
for (ServiceList::iterator it = m_Services.begin(); it != m_Services.end(); it++)
{
Service* pService = *it;
if (iCurTick >= pService->m_iLastTick + pService->ServiceInterval() || // interval expired
iCurTick == 0 || // first start
iCurTick + 10000 < pService->m_iLastTick) // int overflow
{
pService->ServiceWork();
pService->m_iLastTick = iCurTick;
}
}
iCurTick += iStepMSec;
usleep(iStepMSec * 1000);
}
debug("Exiting ServiceCoordinator-loop");
}
示例11: debug
void PrePostProcessor::Run()
{
debug("Entering PrePostProcessor-loop");
while (!DownloadQueue::IsLoaded())
{
usleep(20 * 1000);
}
if (g_Options->GetServerMode() && g_Options->GetSaveQueue() && g_Options->GetReloadQueue())
{
SanitisePostQueue();
}
while (!IsStopped())
{
if (!g_Options->GetTempPausePostprocess())
{
// check post-queue every 200 msec
CheckPostQueue();
}
Util::SetStandByMode(!m_curJob);
usleep(200 * 1000);
}
debug("Exiting PrePostProcessor-loop");
}
示例12: SaveRespawnTime
void Creature::setDeathState(DeathState s)
{
if(s == JUST_DIED)
{
m_deathTimer = m_corpseDelay*1000;
// always save boss respawn time at death to prevent crash cheating
if(sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())
SaveRespawnTime();
if(!IsStopped()) StopMoving();
}
Unit::setDeathState(s);
if(s == JUST_DIED)
{
SetUInt32Value(UNIT_NPC_FLAGS, 0);
if(!isPet() && GetCreatureInfo()->SkinLootId)
{
LootStore skinStore = LootTemplates_Skinning;
LootStore::iterator tab = skinStore.find(GetCreatureInfo()->SkinLootId);
if ( tab != skinStore.end() )
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
}
Unit::setDeathState(CORPSE);
}
}
示例13: debug
void ServiceCoordinator::Run()
{
debug("Entering ServiceCoordinator-loop");
const int stepMSec = 100;
int curTick = 0;
while (!IsStopped())
{
for (Service* service : m_services)
{
if (curTick >= service->m_lastTick + service->ServiceInterval() || // interval expired
curTick == 0 || // first start
curTick + 10000 < service->m_lastTick) // int overflow
{
service->ServiceWork();
service->m_lastTick = curTick;
}
}
curTick += stepMSec;
usleep(stepMSec * 1000);
}
debug("Exiting ServiceCoordinator-loop");
}
示例14: debug
void PrePostProcessor::Run()
{
debug("Entering PrePostProcessor-loop");
while (!DownloadQueue::IsLoaded())
{
usleep(20 * 1000);
}
if (g_Options->GetServerMode())
{
SanitisePostQueue();
}
while (!IsStopped())
{
if (!g_Options->GetTempPausePostprocess() && m_queuedJobs)
{
// check post-queue every 200 msec
CheckPostQueue();
}
usleep(200 * 1000);
}
WaitJobs();
debug("Exiting PrePostProcessor-loop");
}
示例15: StopGas
void Train::Update(const sf::Input &input) {
static sf::Clock clock;
static bool waiting = false;
acceleration = (1/mass) *(push_force - speed * brakes_factor);
speed += acceleration;
position.z += speed;
if (position.z > 900 || position.z < -900) {
position.z = -position.z;
//comingSound.SetPosition(this->position);
comingSound.Play();
StopGas();
}
if (!user_controlled){
if (position.z < -250 && position.z > -300){
StopGas();
Brakes();
}
if (IsStopped() && !waiting){
clock.Reset();
alarm=false;
waiting = true;
printf("\n\n\n waiting\n");
}
if (waiting && clock.GetElapsedTime() > waiting_time) {
Gas();
waiting = false;
printf(" timed out\n");
}
if (waiting && clock.GetElapsedTime() > waiting_time-4 && !alarm) {
alarm=true;
sound.SetBuffer(Buffer);
//sound.SetPitch(0.6);
//sound.SetAttenuation(0.4);
sound.SetRelativeToListener(true);
sound.SetPosition(this->position);
sound.SetMinDistance(100);
sound.Play();
//movmetnSound.SetPosition(this->position);
movmetnSound.Play();
}
light->position = sf::Vector3f(-40.900002,10,position.z + 5) ;
if(camera !=NULL)
camera->SetOrigin(position.x+8.3,position.y+15,position.z);
}else {
if (input.IsKeyDown(sf::Key::Z)) {
push_force = 0.1f;
}else if (input.IsKeyDown(sf::Key::X)){
brakes_factor = 0.05f;
}
}
}