Libraryless. Click here for Pure Java version (1512L/10K/38K).
1 | !7 |
2 | |
3 | static new O a; |
4 | static new O b; |
5 | |
6 | p-tt {
|
7 | centerHigherConsole(); |
8 | startDeadlockDetector(); |
9 | print("Initiating deadlock... :-)\n");
|
10 | |
11 | thread "A" {
|
12 | synchronized(a) {
|
13 | print("Thread A has lock A.");
|
14 | sleep1Second(); |
15 | print("Thread A getting lock B.");
|
16 | synchronized(b) {
|
17 | print("Thread A sleeping.");
|
18 | main.sleep(); |
19 | } |
20 | } |
21 | } |
22 | |
23 | thread "B" {
|
24 | synchronized(b) {
|
25 | print("Thread B has lock B.");
|
26 | sleep1Second(); |
27 | print("Thread B getting lock A.");
|
28 | synchronized(a) {
|
29 | print("Thread B sleeping.");
|
30 | main.sleep(); |
31 | } |
32 | } |
33 | } |
34 | |
35 | sleepQuietly(); |
36 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
| Snippet ID: | #1009280 |
| Snippet name: | Java DeadLock Detection Test :) [WORKS] |
| Eternal ID of this version: | #1009280/11 |
| Text MD5: | effc0c1ab38c8efbd4c8562c84412a69 |
| Transpilation MD5: | 1745d33e491e18d836722d6f50d26454 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-07-23 02:17:43 |
| Source code size: | 676 bytes / 36 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 715 / 955 |
| Version history: | 10 change(s) |
| Referenced in: | [show references] |