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 (614B)


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