summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/Activator.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-01-30 10:42:30 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-01-30 10:42:30 +0000
commit82ca85ceaccdb5c407a83d97457bcce67c02362a (patch)
tree22d72906d35eea676222d23561379643e822eafd /cpp/src/IceGrid/Activator.cpp
parentWorkaround for Linux/waitpid bug (diff)
downloadice-82ca85ceaccdb5c407a83d97457bcce67c02362a.tar.bz2
ice-82ca85ceaccdb5c407a83d97457bcce67c02362a.tar.xz
ice-82ca85ceaccdb5c407a83d97457bcce67c02362a.zip
Minor fixes to previous fix
Diffstat (limited to 'cpp/src/IceGrid/Activator.cpp')
-rw-r--r--cpp/src/IceGrid/Activator.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp
index af69b53ee2b..b9d8976a8bb 100644
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -1237,29 +1237,38 @@ Activator::terminationListener()
int nRetry = 0;
while(true) // The while loop is necessary for the linux workaround.
{
-#endif
pid_t pid = waitpid(p->pid, &status, 0);
if(pid < 0)
{
-#if defined(__linux)
//
- // Some Linux distribution have a bogus waitpid(). It doesn't block and report an incorrect ECHILD error on the first call, we must sleep a little and retry to work around this issue (it appears from testing that a single retry is enough but to make sure we retry up to 10 times before to throw.)
+ // Some Linux distribution have a bogus waitpid() (e.g.: CentOS 4.x). It doesn't
+ // block and reports an incorrect ECHILD error on the first call. We sleep a
+ // little and retry to work around this issue (it appears from testing that a
+ // single retry is enough but to make sure we retry up to 10 times before to throw.)
//
if(errno == ECHILD && nRetry < 10)
{
- IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(nRetry * 10 + 1)); // Wait 1ms, 11ms, 21ms, etc.
+ // Wait 1ms, 11ms, 21ms, etc.
+ IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(nRetry * 10 + 1));
++nRetry;
continue;
}
-#endif
SyscallException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
assert(pid == p->pid);
-#if defined(__linux)
break;
}
+#else
+ pid_t pid = waitpid(p->pid, &status, 0);
+ if(pid < 0)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ assert(pid == p->pid);
#endif
if(_traceLevels->activator > 0)