no message

This commit is contained in:
2023-12-03 17:44:32 +03:00
parent 74df6ffa7d
commit 019977ac92
4 changed files with 23 additions and 10 deletions

View File

@@ -14,11 +14,14 @@ public:
fprintf(ptr, "%s\n", text.getCharArray()); fprintf(ptr, "%s\n", text.getCharArray());
} }
~File() { ~File() {
if (ptr != NULL) { Close();
fclose(ptr); }
ptr = NULL; void Close(){
} if (ptr != NULL) {
} fclose(ptr);
ptr = NULL;
}
}
Text* readLines(){ Text* readLines(){
Text* lines = new Text(); Text* lines = new Text();
int c; int c;

View File

@@ -20,12 +20,13 @@ public:
virtual String getStatePrefix(){ virtual String getStatePrefix(){
return String("Running"); return String("Running");
} }
/*
virtual void Finalize(){ virtual void Finalize(){
this->state = Archivation; this->state = Archivation;
saveState(); saveState();
printf("Archivation started\n"); printf("Archivation started\n");
Utils::ZipFolder(String("./"),String("archive.zip")); Utils::ZipFolder(String("./"),String("archive.zip"));
printf("Archivation ended\n"); printf("Archivation ended\n");
} }
*/
}; };

View File

@@ -83,7 +83,8 @@ public:
break; break;
case Execution: case Execution:
if (task->getState()==WorkspaceReady){ if (task->getState()==WorkspaceReady){
activeCount++; activeCount++;
task->start_time=Utils::getAbsoluteTime();
task->Start(); task->Start();
}else if (task->getState()==Running){ }else if (task->getState()==Running){
activeCount++; activeCount++;

View File

@@ -35,12 +35,14 @@ enum TestType{
#pragma once #pragma once
class Task { class Task {
protected: protected:
long id; long id;
int maxtime; int maxtime;
int kernels; //получение зависит от типа задачи. int kernels; //получение зависит от типа задачи.
String workspace; String workspace;
TaskState state; TaskState state;
public: public:
long start_time;
String printState(){ String printState(){
switch(state){ switch(state){
case Inactive: case Inactive:
@@ -146,7 +148,13 @@ public:
//todo определить по интервалу времени на всякий случай. //todo определить по интервалу времени на всякий случай.
}else if (Utils::Exists(workspace+"/INTERRUPT")){ }else if (Utils::Exists(workspace+"/INTERRUPT")){
state=AbortedByUser; state=AbortedByUser;
} } else {
long now = Utils::getAbsoluteTime();
long delta = now-start_time;
if (maxtime<delta){
state=AbortedByTimeout;
}
}
} }
if (state!=Running){ if (state!=Running){
//- //-