putme/monitorme return 1 on timeout
This commit is contained in:
@ -260,6 +260,7 @@ int main(int argc, char *argv[]) {
|
|||||||
monitors.push_back(mon);
|
monitors.push_back(mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
{
|
{
|
||||||
Guard G(mutex);
|
Guard G(mutex);
|
||||||
while(waitingFor) {
|
while(waitingFor) {
|
||||||
@ -268,6 +269,7 @@ int main(int argc, char *argv[]) {
|
|||||||
done.wait();
|
done.wait();
|
||||||
} else if(!done.wait(waitTime)) {
|
} else if(!done.wait(waitTime)) {
|
||||||
std::cerr<<"Timeout\n";
|
std::cerr<<"Timeout\n";
|
||||||
|
ret = 1;
|
||||||
break; // timeout
|
break; // timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,10 +283,10 @@ int main(int argc, char *argv[]) {
|
|||||||
refmon.current();
|
refmon.current();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
monwork.close();
|
||||||
|
return ret;
|
||||||
} catch(std::exception& e){
|
} catch(std::exception& e){
|
||||||
std::cout<<"Error: "<<e.what()<<"\n";
|
std::cout<<"Error: "<<e.what()<<"\n";
|
||||||
return 1;
|
return 2;
|
||||||
}
|
}
|
||||||
monwork.close();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -212,6 +212,7 @@ int main(int argc, char *argv[]) {
|
|||||||
signal(SIGQUIT, alldone);
|
signal(SIGQUIT, alldone);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
{
|
{
|
||||||
Guard G(mutex);
|
Guard G(mutex);
|
||||||
while(waitingFor) {
|
while(waitingFor) {
|
||||||
@ -220,16 +221,17 @@ int main(int argc, char *argv[]) {
|
|||||||
done.wait();
|
done.wait();
|
||||||
} else if(!done.wait(waitTime)) {
|
} else if(!done.wait(waitTime)) {
|
||||||
std::cerr<<"Timeout\n";
|
std::cerr<<"Timeout\n";
|
||||||
|
ret = 1;
|
||||||
break; // timeout
|
break; // timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
} catch(std::exception& e){
|
} catch(std::exception& e){
|
||||||
PRINT_EXCEPTION(e);
|
PRINT_EXCEPTION(e);
|
||||||
std::cerr<<"Error: "<<e.what()<<"\n";
|
std::cerr<<"Error: "<<e.what()<<"\n";
|
||||||
return 1;
|
return 2;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user