No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I wrote a few code to test fork like following: [code]#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <signal.h> #include <errno.h> #include <unistd.h> int DemoFork() { pid_t pid,par_pid; par_pid = getpid(); pid = fork(); switch (pid) { case -1: printf("failure!\n"); break; case 0: printf("I am child!, parent is %d(\n",par_pid); break; default: … |
|
I write a small program like following: 1, firstly create a process waiting for keyboard input commands(via getchar()). 2, secondly create a thread in the process waiting on a message queue. each time after the thread receive a message, it can handle the message but cannot print the log message(via … |