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

17
LINES

< > BotCompany Repo | #1000736 - sleep functions

JavaX fragment (include)

1  
static volatile bool sleep_noSleep;
2  
3  
static void 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  
static void sleep() ctex {
14  
  if (sleep_noSleep) fail("nosleep");
15  
  print("Sleeping.");
16  
  sleepQuietly();
17  
}

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

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