-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path25.cpp
More file actions
27 lines (27 loc) · 664 Bytes
/
25.cpp
File metadata and controls
27 lines (27 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "/usr/include/msgpack/predef/os/unix.h"
#include <stdio.h>
using namespace std;
int child_function() {
while (true) // Loop forever.
{
printf("Child loop\n");
os_this_process::sleep(1);
}
return 0; // Will never execute.
}
int main() {
os_unix_toolkit initialize;
os_process child(child function); // Spawn child.
os_this_process::sleep(4);
printf("child.suspend()\n");
child.suspend();
printf("Parent sleeps for 4 seconds\n");
os_this_process::sleep(4);
printf("child.resume()");
child.resume();
os_this_process::sleep(4);
printf("child.terminate()");
child.terminate();
printf("Parent finished");
return 0;
}