示例#1
0
static void xbt_preinit(void) {
  unsigned int seed = 2147483647;
#ifdef _WIN32
  SYSTEM_INFO si;
  GetSystemInfo(&si);
  xbt_pagesize = si.dwPageSize;
#elif HAVE_SYSCONF
  xbt_pagesize = sysconf(_SC_PAGESIZE);
#else
  #error Cannot get page size.
#endif

  xbt_pagebits = 0;
  int x = xbt_pagesize;
  while(x >>= 1) {
    ++xbt_pagebits;
  }

#ifdef _TWO_DIGIT_EXPONENT
  /* Even printf behaves differently on Windows... */
  _set_output_format(_TWO_DIGIT_EXPONENT);
#endif
  xbt_log_preinit();
  xbt_backtrace_preinit();
  xbt_os_thread_mod_preinit();
  xbt_fifo_preinit();
  xbt_dict_preinit();
   
  srand(seed);
#ifndef _WIN32
  srand48(seed);
#endif
  atexit(xbt_postexit);
}
示例#2
0
static void xbt_preinit(void)
{
#ifdef MMALLOC_WANT_OVERRIDE_LEGACY
  mmalloc_preinit();
#endif
  xbt_log_preinit();
  xbt_backtrace_preinit();
  xbt_os_thread_mod_preinit();
  xbt_fifo_preinit();
  xbt_dict_preinit();
  atexit(xbt_postexit);
}