nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

sleep.h (643B)


      1 #define BASE_SLEEP_TIME 500
      2 
      3 STATIC void msleep(int);
      4 
      5 #if defined(WIN32)
      6 
      7 #define NISSY_CANSLEEP true
      8 
      9 STATIC void
     10 msleep(int milliseconds)
     11 {
     12 	Sleep(milliseconds);
     13 }
     14 
     15 #elif defined(__wasm__)
     16 
     17 #include <emscripten.h>
     18 
     19 #define NISSY_CANSLEEP true
     20 
     21 STATIC void
     22 msleep(int milliseconds)
     23 {
     24 	emscripten_sleep(milliseconds);
     25 }
     26 
     27 #elif defined(__unix__)
     28 
     29 #include <time.h>
     30 
     31 #define NISSY_CANSLEEP true
     32 
     33 STATIC void
     34 msleep(int milliseconds)
     35 {
     36 	struct timespec t;
     37 	t.tv_sec = milliseconds / 1000;
     38 	t.tv_nsec = (milliseconds % 1000) * 1000000;
     39 	nanosleep(&t, NULL);
     40 }
     41 
     42 #else
     43 
     44 #define NISSY_CANSLEEP false
     45 STATIC void
     46 msleep(int milliseconds)
     47 {
     48 }
     49 
     50 #endif