Newsgroups: comp.os.parix
From: christian.renevey@unifr.ch (Renevey Christian)
Subject: blocking ConnectLink call
Organization: IIUF
Date: 8 Aug 1996 12:48:21 GMT
Message-ID: <4ucnml$g3j@siufuxsun01.unifr.ch>

hi everybody,

here is a small program which block on the ConnectLink call. 
Could somebody help me ?
ConnectLink is only successfull on node 0 and block on the other node ...
Could I established a link between two binary running on two different nodes ?




/* -------------------------------------------------------*/
/* proc to start a new binary assynchronously */
int AExecute(char *px_file_name){
  /*printf("file=%s\n",px_file_name);*/
  return Execute(px_file_name, parix_environ);
}
Thread_t* TB_AExecute(char *px_file_name){
   int Error;
   Thread_t *CreatedThread;
   char *file_name;

   file_name = (char *)malloc(64*sizeof(char));
   strcpy(file_name, px_file_name);
   CreatedThread = StartThread(AExecute, 10000000, &Error, 64, file_name);
   if (CreatedThread == NULL) {
      LogError(EC_ERROR, "TB_AExecute()", "Could not create thread!\n");
      exit(1);
   }
   return CreatedThread;
}

/*-------------------------------------------------------------*/
/* host program  started with px run -f 0 2 1 host */

main()
{
   int nProcs, myProcID, proc; 
   int result,error;
   int msg;
   LinkCB_t*    linkList[16];
   Thread_t *t;

   nProcs = GET_ROOT () -> ProcRoot -> nProcs;
   myProcID = GET_ROOT () -> ProcRoot -> MyProcID;
   printe("host started: i'm %d\n", myProcID);

   /* start the binary called node */
   t = TB_AExecute("node");

   if ((myProcID) == 0) {

      /* connect link to node proc */
      /* this loop never teminate !! */
      for(proc = 0; proc < nProcs; proc++) {
         linkList[proc] = ConnectLink (proc,REQUEST,&error);
      }  

   }
   else ; 
}

/*-------------------------------------------------------------*/
/* node program  started from host program*/

main()
{
   int error, msg;
   LinkCB_t     *link;

   my_node;         /* node id                     */

   my_node = GET_ROOT () -> ProcRoot -> MyProcID;

   link = ConnectLink (my_node,REQUEST,&error);
   if (link == NULL) {
     LogError (EC_ERROR, "",
               "Failed to make link to host, error code %d.", error);
     exit (1);
   }

}



#+----------------------------------------------------------------------
#+
#+  Christian RENEVEY                      address:				
#+  email:  <Christian.Renevey@unifr.ch>      RENEVEY Christian	
#+  tel: +41 37 - 298468                      Institut d'Informatique 
#+  fax: +41 37 - 299731                      Universite de Fribourg	
#+  http://www.unifr.ch                       Chemin du musee 3	
#+                                            1700 Fribourg(SWITZERLAND)
#+----------------------------------------------------------------------


