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

7
LINES

< > BotCompany Repo | #1031684 // tempSetBetterThreadLocalIfNecessary_weakRef - compares with existing value first. wraps value in WeakReference

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

Libraryless. Click here for Pure Java version (62L/1K).

static <A> AutoCloseable tempSetBetterThreadLocalIfNecessary_weakRef(x30_pkg.x30_util.BetterThreadLocal<WeakReference> tl, A a) {
  if (tl == null) null;
  WeakReference prev = tl.get();
  if (eq(getWeakRef(prev), a)) null;
  tl.set(weakRef(a));
  ret autoCloseable { tl.set(prev); };
}

Author comment

Began life as a copy of #1031639

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031684
Snippet name: tempSetBetterThreadLocalIfNecessary_weakRef - compares with existing value first. wraps value in WeakReference
Eternal ID of this version: #1031684/1
Text MD5: c920d077de4875702ed9c813dac444c7
Transpilation MD5: 1ed109b376e4887c1fe71dc81a1c66e3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-27 00:09:46
Source code size: 292 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 154 / 237
Referenced in: [show references]