9.3. Starting qserve and nserve - start_qnserves

The Cogent C API utilities qserve and nserve support interprocess communication, and must be started before any IPC is performed within the demo. Due to underlying differences in QNX 4 and QNX 6 OS architecture, the program has to use different functions (wrapped by the abstracted function anyos_find_process) to see if the processes are already running, and then start the two utilities accordingly.

[Note]

These utilities are now started automatically by the Cogent program that uses them; this code is simply a fail-safe.

   /*--------------------------------------------------------------------
    * Function:    start_qnserves
    * Returns:     t on success, or nil
    * Description: Used to start qserve or nserve, as specified.
    *------------------------------------------------------------------*/
   function start_qnserves(command, name)
   {
     for(i=0; i<=50; i++)
       {
         if ((anyos_find_process(command, name) == nil))
           {
             system(command);
             usleep(10000);
           }
         else
           {
             i = 50;
             nil;
           }
       }
   }