sclass AutoInitVar<A> extends Var<A> { O make; bool has; Lock lock = lock(); *() {} *(O *make) {} public A get() { if (has) ret super.get(); lock lock; if (has) ret super.get(); set((A) pcallF(make)); make = null; has = true; ret super.get(); } }
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: | #1009679 |
Snippet name: | AutoInitVar - thread-safe variable that initializes itself once |
Eternal ID of this version: | #1009679/2 |
Text MD5: | 6bb98c46a4ed39f26c2b1d873c6bb9f2 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-29 00:06:14 |
Source code size: | 311 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 550 / 1558 |
Version history: | 1 change(s) |
Referenced in: | [show references] |