Ejemplo n.º 1
0
Archivo: log.c Proyecto: R7R8/simgrid
/* create the default appender and install it in the root category,
   which were already created (damnit. Too slow little beetle) */
void xbt_log_preinit(void)
{
  xbt_log_default_appender = xbt_log_appender_file_new(NULL);
  xbt_log_default_layout = xbt_log_layout_simple_new(NULL);
  _XBT_LOGV(XBT_LOG_ROOT_CAT).appender = xbt_log_default_appender;
  _XBT_LOGV(XBT_LOG_ROOT_CAT).layout = xbt_log_default_layout;
  log_cat_init_mutex = xbt_os_mutex_init();
}
Ejemplo n.º 2
0
void rctx_init(void)
{
  struct sigaction newact;
  int i;
  fg_job = 0;
  bg_jobs = xbt_dynar_new(sizeof(rctx_t), kill_it);
  armageddon_mutex = xbt_os_mutex_init();
  armageddon_initiator = NULL;
  sigwaiter_mutex = xbt_os_mutex_init();
  sigwaiter_cond = xbt_os_cond_init();
  xbt_os_mutex_acquire(sigwaiter_mutex);
  sigwaiter_thread = xbt_os_thread_create("Armaggedon request waiter",
                                          armageddon_sigwaiter, NULL, NULL);
  /* Wait for thread to start... */
  xbt_os_cond_wait(sigwaiter_cond, sigwaiter_mutex);
  xbt_os_mutex_release(sigwaiter_mutex);
  memset(&newact, 0, sizeof(newact));
  newact.sa_handler = armageddon_sighandler;
  oldact[0].num = SIGINT;
  oldact[1].num = SIGQUIT;
  oldact[2].num = SIGTERM;
  for (i = 0; i < 3; i++)
    sigaction(oldact[i].num, &newact, &oldact[i].act);
}