45 if (pipe(
pfd1) < 0 || pipe(
pfd2) < 0) {
46 fprintf(stderr,
"[%s] pipe error...\n", __func__);
60 if (write(
pfd2[1],
"c", 1) != 1) {
61 fprintf(stderr,
"[%s] write error...\n", __func__);
76 if (read(
pfd1[0], &recv, 1) != 1) {
77 fprintf(stderr,
"[%s] read error...\n", __func__);
82 fprintf(stderr,
"[%s] incorrect data received(%c)\n", __func__,
97 if (write(
pfd1[1],
"p", 1) != 1) {
98 fprintf(stderr,
"[%s] write error...\n", __func__);
113 if (read(
pfd2[0], &recv, 1) != 1) {
114 fprintf(stderr,
"[%s] read error...\n", __func__);
119 fprintf(stderr,
"[%s] incorrect data received(%c)\n", __func__,
static int TELL_WAIT(void)
Pipe initialize sequence. You must call before use this source.
Definition: sync.h:43
static int TELL_PARENT(void)
The child calls parents.
Definition: sync.h:58
static int pfd1[2]
Definition: sync.h:36
static int WAIT_PARENT(void)
Receive from parent's call.
Definition: sync.h:72
static int pfd2[2]
Definition: sync.h:36
static int WAIT_CHILD(void)
Receive from child's call.
Definition: sync.h:109
static int TELL_CHILD(void)
The parent calls children.
Definition: sync.h:95