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

27
LINES

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

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2539L/16K).

static void lock(Lock lock) ctex {
  ping();
  if (lock == null) ret;
  try {
    lock.lockInterruptibly();
  } catch (InterruptedException e) {
    O reason = vm_threadInterruptionReasonsMap().get(currentThread());
    print("Locking interrupted! Reason: " + strOr(reason, "Unknown");
    printStackTrace(e);
    rethrow(e);
  }
  // NO call to ping here! Make sure lock is always released.
}

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 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, xrpafgyirdlv

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/13
Text MD5: ad57ecd01187421baa83e94a2acb5b1e
Transpilation MD5: dbc1cc81acaa1b685beae9437fbb704e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-30 19:53:17
Source code size: 663 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 397 / 454
Version history: 12 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1007380 & http://1007380.tinybrain.de