run_timeout

This commit is contained in:
Zengtudor 2024-08-18 13:05:25 +08:00
parent e74c692fe6
commit b9d2040a2c
2 changed files with 7 additions and 7 deletions

View File

@ -143,10 +143,10 @@ int main(int argc, char* argv[]) {
std::filesystem::create_directory(buildDir); std::filesystem::create_directory(buildDir);
} }
LOG("getting run time out") LOG("getting run time out")
int runtimeout = 0; int run_timeout = 0;
if(jsonValue["runtimeout"]!=Json::nullValue){ if(jsonValue["run_timeout"]!=Json::nullValue){
runtimeout = jsonValue["runtimeout"].asInt(); run_timeout = jsonValue["run_timeout"].asInt();
printValue(runtimeout) printValue(run_timeout)
} }
LOG("compiling") LOG("compiling")
string compileCommands; string compileCommands;
@ -219,8 +219,8 @@ int main(int argc, char* argv[]) {
} }
vector<ProgramRet> results(jsonTests.size()+1); vector<ProgramRet> results(jsonTests.size()+1);
for(auto &i:futures){ for(auto &i:futures){
if(runtimeout>0){ if(run_timeout>0){
if(i.wait_for(std::chrono::milliseconds(runtimeout))==std::future_status::ready){ if(i.wait_for(std::chrono::milliseconds(run_timeout))==std::future_status::ready){
auto ret = i.get(); auto ret = i.get();
results[ret.id]=ret; results[ret.id]=ret;
} }

View File

@ -15,5 +15,5 @@
"ans":"2.ans" "ans":"2.ans"
} }
], ],
"runtimeout":100 "run_timeout":100
} }