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

17
LINES

< > BotCompany Repo | #1000736 // sleep function

JavaX fragment (include)

static volatile bool sleep_noSleep;

svoid 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); }
}

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

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1000736
Snippet name: sleep function
Eternal ID of this version: #1000736/10
Text MD5: 08beb67cf9f0e62004097758bd285d3c
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-03 17:10:13
Source code size: 392 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 691 / 6108
Version history: 9 change(s)
Referenced in: [show references]