A waitWhile method copy turned into wrapper

develop
Petr Mrázek 2010-03-05 02:45:53 +01:00
parent 73f95e4a6d
commit 9aedc56186
1 changed files with 1 additions and 34 deletions

@ -128,40 +128,7 @@ we end up with this silly thing
*/
bool Process::waitWhile (uint32_t state)
{
uint32_t cnt = 0;
struct shmid_ds descriptor;
while (D_SHMCMD == state)
{
if(cnt == 10000)// check if the other process is still there
{
shmctl(d->my_shmid, IPC_STAT, &descriptor);
if(descriptor.shm_nattch == 1)// DF crashed?
{
D_SHMCMD = CORE_RUNNING;
d->attached = d->suspended = false;
return false;
}
else
{
cnt = 0;
}
}
if(d->useYield)
{
SCHED_YIELD
}
cnt++;
}
if(D_SHMCMD == CORE_SV_ERROR)
{
D_SHMCMD = CORE_RUNNING;
d->attached = d->suspended = false;
cerr << "shm server error!" << endl;
assert (false);
return false;
}
return true;
return d->waitWhile(state);
}
bool Process::Private::DF_TestBridgeVersion(bool & ret)