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

18
LINES

< > BotCompany Repo | #1008789 // Test Thread.holdsLock [WORKS]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (438L/3K/12K).

1  
!7
2  
3  
p {
4  
  assertFalse(Thread.holdsLock(mc()));
5  
  synchronized(mc()) {
6  
    assertTrue(Thread.holdsLock(mc()));
7  
  }
8  
  assertFalse(Thread.holdsLock(mc()));
9  
  
10  
  new O o;
11  
  assertFalse(Thread.holdsLock(o));
12  
  synchronized(o) {
13  
    assertTrue(Thread.holdsLock(o));
14  
  }
15  
  assertFalse(Thread.holdsLock(o));
16  
  
17  
  print("OK");
18  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008789
Snippet name: Test Thread.holdsLock [WORKS]
Eternal ID of this version: #1008789/2
Text MD5: c4e57f128ccb54f548b93432a4274ce5
Transpilation MD5: 539586dcd4737e03768f2ccfd7b50556
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-06 09:49:41
Source code size: 336 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 466 / 579
Version history: 1 change(s)
Referenced in: [show references]