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

17
LINES

< > BotCompany Repo | #1000736 // sleep function

JavaX fragment (include)

1  
static volatile bool sleep_noSleep;
2  
3  
svoid sleep(long ms) {
4  
  ping();
5  
  if (ms < 0) ret;
6  
  // allow spin locks
7  
  if (isAWTThread() && ms > 100) fail("Should not sleep on AWT thread");
8  
  try {
9  
    Thread.sleep(ms);
10  
  } catch (Exception e) { throw new RuntimeException(e); }
11  
}
12  
13  
svoid sleep() ctex {
14  
  if (sleep_noSleep) fail("nosleep");
15  
  print("Sleeping.");
16  
  sleepQuietly();
17  
}

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: 868 / 6302
Version history: 9 change(s)
Referenced in: [show references]