1 | static void lockOrFail(Lock lock, long timeout) ctex { |
2 | ping(); |
3 | vmBus_send locking(lock, thread := currentThread()); |
4 | if (!lock.tryLock(timeout, TimeUnit.MILLISECONDS)) { |
5 | S s = "Couldn't acquire lock after " + timeout + " ms."; |
6 | if (lock instanceof ReentrantLock) { |
7 | ReentrantLock l = cast lock; |
8 | s += " Hold count: " + l.getHoldCount() + ", owner: " + call(l, "getOwner"); |
9 | } |
10 | fail(s); |
11 | } |
12 | vmBus_send locked(lock, thread := currentThread()); |
13 | ping(); |
14 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007379 |
Snippet name: | lockOrFail - try to acquire a Lock; fail after timeout |
Eternal ID of this version: | #1007379/9 |
Text MD5: | b78bbc96662e3929497b88f401750496 |
Author: | stefan |
Category: | javax / concurrency |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-22 09:08:36 |
Source code size: | 496 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 557 / 594 |
Version history: | 8 change(s) |
Referenced in: | [show references] |