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

17
LINES

< > BotCompany Repo | #1011285 // Test if finally block is executed when thread is interrupted (it is!)

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

Download Jar. Libraryless. Click here for Pure Java version (1076L/8K).

!7

static Lock lock = lock();

p {
  lock lock;
  Thread t = newThread(r {
    try {
      lock lock;
    } finally {
      print("Finally!");
    }
  });
  startThread(t);
  sleepSeconds(1);
  t.interrupt();
}

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: #1011285
Snippet name: Test if finally block is executed when thread is interrupted (it is!)
Eternal ID of this version: #1011285/2
Text MD5: b4873ec146f314814cf4d6ae564c4b80
Transpilation MD5: ef3e078fb5054026dcbc5e171f0ff9ed
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-22 03:18:11
Source code size: 227 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 960
Version history: 1 change(s)
Referenced in: [show references]