Libraryless. Click here for Pure Java version (1344L/9K/33K).
1 | !7 |
2 | |
3 | static Lock a = fairLock(); |
4 | static Lock b = fairLock(); |
5 | |
6 | p-tt {
|
7 | centerHigherConsole(); |
8 | print("Initiating deadlock... :-)\n");
|
9 | |
10 | thread "A" {
|
11 | lock a; // cool new syntax! |
12 | print("Thread A has lock A.");
|
13 | sleep1Second(); |
14 | print("Thread A getting lock B.");
|
15 | lock b; |
16 | print("Thread A successful!");
|
17 | } |
18 | |
19 | thread "B" {
|
20 | lock b ; |
21 | print("Thread B has lock B.");
|
22 | sleep1Second(); |
23 | print("Thread B getting lock A.");
|
24 | lock a; |
25 | print("Thread B successful!");
|
26 | } |
27 | |
28 | sleepQuietly(); |
29 | } |
Began life as a copy of #1009311
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: | #1009356 |
| Snippet name: | Java New DeadLock Test (should now be solved by JavaX core automatically!) |
| Eternal ID of this version: | #1009356/3 |
| Text MD5: | a05c4b480a1d97c934c5121b7b44d99a |
| Transpilation MD5: | 5d0a91c900bd06aaa86e5a50510d87e7 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-07-24 17:00:00 |
| Source code size: | 555 bytes / 29 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 729 / 894 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |