fixed merge

This commit is contained in:
2023-12-03 18:02:15 +03:00
6 changed files with 110 additions and 79 deletions

View File

@@ -3,23 +3,25 @@ using namespace std;
#if __cplusplus >= 201703L
#include <filesystem>
#else
#include <unistd.h>
#endif
#include "CompilationSupervisor.h"
#include "RunSupervisor.h"
#include "Global.h"
#include <unistd.h>
#include <signal.h>
//https://ru.wikipedia.org/wiki/%D0%A1%D0%B8%D0%B3%D0%BD%D0%B0%D0%BB_(Unix)
void hdl(int sig)
{
String file_name = "GOT_SIGNAL_AT_"+String(Utils::getAbsoluteTime());
String file_name = "GOT_SIGNAL_AT_"+ String(Utils::getAbsoluteTime());
FILE * res = fopen(file_name.getCharArray(),"w");
fprintf(res,"%d\n", sig);
fclose(res);
}
void set_handlers(){
void set_handlers() {
#ifndef _WIN32
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = hdl;
@@ -80,7 +82,9 @@ void set_handlers(){
sigaction(SIGVTALRM, &act, 0);
sigaction(SIGXCPU, &act, 0);
sigaction(SIGXFSZ, &act, 0);
#endif
}
int main(int argc, char ** argv)
{
//+
@@ -104,7 +108,12 @@ int main(int argc, char ** argv)
userWorkspace.println();
packageWorkspace.println();
printf("%d\n", maxKernels);
#ifndef _WIN32
int pid = getpid();
#else
int pid = _getpid();
#endif
printf("PID=%d\n", pid);
File pidFile("PID", String(pid));
pidFile.Close();