Files
operating-systems/threads/ex19.c
Fabio Scotto di Santolo 53f42a2032 Move source in the folder
2024-08-27 09:19:46 +02:00

19 lines
320 B
C

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int main(void) {
pid_t parent_pid = getpid();
pid_t pid = fork();
if (pid > 0) {
printf("PARENT PID = %d, CHILD PID = %d\n", parent_pid, pid);
sleep(10);
wait(NULL);
}
return EXIT_SUCCESS;
}