update formatting
This commit is contained in:
parent
c3c04b7697
commit
7321708c66
@ -13,15 +13,13 @@ int main() {
|
|||||||
memcpy(shmem, parent_message, sizeof(parent_message));
|
memcpy(shmem, parent_message, sizeof(parent_message));
|
||||||
|
|
||||||
int pid = fork();
|
int pid = fork();
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
printf("Child read: %s\n", (char*)shmem);
|
printf("Child read: %s\n", (char*)shmem);
|
||||||
memcpy(shmem, child_message, sizeof(child_message));
|
memcpy(shmem, child_message, sizeof(child_message));
|
||||||
printf("Child wrote: %s\n", (char*)shmem);
|
printf("Child wrote: %s\n", (char*)shmem);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
printf("Parent read: %s\n", (char*)shmem);
|
printf("Parent read: %s\n", (char*)shmem);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
printf("After 1s, parent read: %s\n", (char*)shmem);
|
printf("After 1s, parent read: %s\n", (char*)shmem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user