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

26
LINES

< > TinyBrain | #1007380 - lock - acquire Lock with message; also lock() is a synonym of fairLock()

JavaX fragment (include)

static void lock(Lock lock) ctex {
  ping();
  if (lock == null) ret;
  try {
    lock.lockInterruptibly();
  } catch (InterruptedException e) {
    print("Locking interrupted! I probably deadlocked, oops.");
    printStackTrace(e);
    rethrow(e);
  }
  ping();
}

static void lock(Lock lock, S msg) {
  print("Locking: " + msg);
  lock(lock);
}

static void lock(Lock lock, S msg, long timeout) {
  print("Locking: " + msg);
  lockOrFail(lock, timeout);
}

static ReentrantLock lock() {
  ret fairLock();
}

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1007380
Snippet name: lock - acquire Lock with message; also lock() is a synonym of fairLock()
Eternal ID of this version: #1007380/10
Text MD5: 0f60a23f3478d9cece2bc77474a7bb56
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-23 18:10:05
Source code size: 533 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 271 / 302
Version history: 9 change(s)
Referenced in: [show references]