check for waitid and NOWAIT
[m6w6/libmemcached] / test / lib / Cluster.cpp
index 37ec184e54d5f141ecd0c71b30b99e359d72f20d..de05a79769663e4801866c2c1d4ace41864233b8 100644 (file)
@@ -98,6 +98,7 @@ void Cluster::wait() {
   siginfo_t inf;
 
   while (!isStopped()) {
+#if HAVE_WAITID_NOWAIT
     if (waitid(P_ALL, 0, &inf, WEXITED | WNOWAIT)) {
       perror("Cluster::wait waitid()");
       return;
@@ -107,6 +108,9 @@ void Cluster::wait() {
     if (server != pids.end()) {
       server->second->wait();
     }
+#else
+    this_thread::sleep_for(100ms);
+#endif
   }
 }