示例#1
0
void ltr_int_gui_lock_clean()
{
    if(pfSem != NULL) {
        ltr_int_unlockSemaphore(pfSem);
        ltr_int_closeSemaphore(pfSem);
        pfSem= NULL;
    }
}
示例#2
0
static bool start_master(int *l_master_uplink, int *l_master_downlink)
{
  bool is_child;
  //master inherits fds!
  int fifo = ltr_int_open_fifo_exclusive(ltr_int_master_fifo_name(), &master_lock);
  if(fifo > 0){
    //no master there yet, so lets start one
    close(fifo);
    ltr_int_unlockSemaphore(master_lock);
    ltr_int_closeSemaphore(master_lock);
    close_master_comms(l_master_uplink, l_master_downlink);
    ltr_int_log_message("Master is not running, start it\n");
    char *args[] = {"srv", NULL};
    args[0] = ltr_int_get_app_path("/ltr_server1");
    ltr_int_fork_child(args, &is_child);
    int status;
    //Disable the wait when not daemonizing master!!!
    wait(&status);
    //At this point master is either running or exited (depending on the state of fifo)
    free(args[0]);
  }
  //At this point either master runs already, or we just started one
  return true;
}