当前位置: 技术问答>linux和unix
请问两子进程间的通信,急急啊!
来源: 互联网 发布时间:2015-08-06
本文导语: 请问两子进程间的通信,我的程序如下: #include #include #include #include #include #include void second (); void first (); int main (int argc, char ** argv) { int status; pid_t pid1, pid2, ppid; if ((pid1 = for...
请问两子进程间的通信,我的程序如下:
#include
#include
#include
#include
#include
#include
void second ();
void first ();
int main (int argc, char ** argv)
{
int status;
pid_t pid1, pid2, ppid;
if ((pid1 = fork ()) == 0)
{
pid1 = getpid ();
printf ("in child first process!n");
signal (SIGUSR1, first);
sleep (5);
if (kill (pid2, SIGUSR1)
#include
#include
#include
#include
#include
#include
void second ();
void first ();
int main (int argc, char ** argv)
{
int status;
pid_t pid1, pid2, ppid;
if ((pid1 = fork ()) == 0)
{
pid1 = getpid ();
printf ("in child first process!n");
signal (SIGUSR1, first);
sleep (5);
if (kill (pid2, SIGUSR1)