FACT++  1.0
static pid_t fork_em ( )
static

Definition at line 17 of file dim_fork.cxx.

References dim_init(), dis_add_service, dis_start_serving, dis_stop_serving, and run.

Referenced by main().

17  {
18  // ::dis_remove_service(id);
20  ::printf("Sleep a bit to see task disappear in did\n");
21  //::sleep(3);
22  pid_t pid = ::fork();
23  if ( pid == 0 ) {
24  ::dim_init();
25  ::printf("PID:%d Register Child service Child/run to DNS....\n",::getpid());
26  id = ::dis_add_service((char*)"Child/run",(char*)"I",&run,sizeof(run),0,0);
27  ::dis_start_serving((char*)"Child");
28  }
29  else if ( pid > 0 ) {
30  ::dim_init();
31  //::sleep(3);
32  ::printf("PID:%d RE-Register Parent to DNS....\n",::getpid());
33  id = ::dis_add_service((char*)"Parent/run",(char*)"I",&run,sizeof(run),0,0);
34  // id_cmd = :: dis_add_cmnd((char *)"Parent/cmd",(char*)"C",handle_cmd,0);
35  ::dis_start_serving((char*)"Parent");
36  }
37  else {
38  ::printf("ERROR in fork!!!! %s\n",strerror(errno));
39  ::exit(0);
40  }
41  return pid;
42 }
void dim_init()
Definition: dim_thr.c:111
#define dis_start_serving
Definition: dis.h:8
#define dis_stop_serving
Definition: dis.h:9
static int run
Definition: dim_fork.cxx:9
#define dis_add_service
Definition: dis.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function: