| #ifdef _MSC_VER |
| |
| #define _CRT_SECURE_NO_WARNINGS |
| #include <windows.h> |
| |
| #else |
| |
| #include <unistd.h> |
| #include <sys/types.h> |
| #include <semaphore.h> |
| #include <signal.h> |
| #include <cstring> |
| #include <sys/wait.h> |
| |
| #endif |
| |
| #include <iostream> |
| #include <stdio.h> |
| #include <string> |
| using namespace std; |
| |
| #ifdef _MSC_VER |
| |
| #define UP_EVENT 'U' |
| #define DOWN_EVENT 'D' |
| #define EXIT_EVENT 'E' |
| #define ACCESS_EVENT "A" |
| #define PATH "..\\Debug\\labka2_spo_child_lin.exe" |
| |
| #endif |
| |
| #define PROCESSCOUNT 4 |
| |
| #ifdef _MSC_VER |
| STARTUPINFOA si[PROCESSCOUNT]; |
| PROCESS_INFORMATION pi[PROCESSCOUNT]; |
| HANDLE upEvent[PROCESSCOUNT], downEvent[PROCESSCOUNT], exitEvent[PROCESSCOUNT], accessEvent; |
| |
| #else |
| |
| #define PATH "child" |
| int pid[PROCESSCOUNT]; |
| bool fl; |
| void synchandler(int p){ |
| fl = false; |
| } |
| |
| #endif |