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

11
LINES

< > BotCompany Repo | #1018971 // syncIncIntVar

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

Libraryless. Click here for Pure Java version (2304L/15K).

static Int syncIncIntVar(Var<Int> v, int i) {
  if (v == null) null;
  synchronized(v) {
    v.set(or0(v!)+i);
    ret v!;
  }
}

static Int syncIncIntVar(Var<Int> v) {
  ret syncIncIntVar(v, 1);
}

Author comment

Began life as a copy of #1016546

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1018971
Snippet name: syncIncIntVar
Eternal ID of this version: #1018971/5
Text MD5: b8e7a7ee332ff9175c894499c12acc4b
Transpilation MD5: eff99f21a68ad56f72e505d51b58d671
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-20 15:49:05
Source code size: 207 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 230 / 304
Version history: 4 change(s)
Referenced in: [show references]