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

7
LINES

< > BotCompany Repo | #1033545 // tempSetTL_noInit

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

Libraryless. Click here for Pure Java version (4540L/25K).

static <A> AutoCloseable tempSetTL_noInit(BetterThreadLocal<A> tl, A a) {
  if (tl == null) null;
  A prev = tl.isSet() ? tl.get() : null;
  if (eq(prev, a)) null;
  tl.set(a);
  ret autoCloseable { tl.set(prev); };
}

Author comment

Began life as a copy of #1018288

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033545
Snippet name: tempSetTL_noInit
Eternal ID of this version: #1033545/1
Text MD5: a02e85d28d51ceb56456189bbd86720b
Transpilation MD5: 16e8b17942c1a8a1e2a3ca78f82f88d9
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-02 02:48:52
Source code size: 223 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 95 / 135
Referenced in: [show references]