Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1000736 - sleep functions

JavaX fragment (include)

static volatile bool sleep_noSleep;

static void sleep(long ms) {
  ping();
  if (ms < 0) ret;
  // allow spin locks
  if (isAWTThread() && ms > 100) fail("Should not sleep on AWT thread");
  try {
    Thread.sleep(ms);
  } catch (Exception e) { throw new RuntimeException(e); }
}

static void sleep() ctex {
  if (sleep_noSleep) fail("nosleep");
  print("Sleeping.");
  sleepQuietly();
}

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1000736
Snippet name: sleep functions
Eternal ID of this version: #1000736/8
Text MD5: 82b100ad3e9fd5c78d2f92fa9ae9f186
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-23 19:39:25
Source code size: 404 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 499 / 5823
Version history: 7 change(s)
Referenced in: #1002427 #1006654 #1007238 #1014902 #3000382

Formerly at http://tinybrain.de/1000736 & http://1000736.tinybrain.de