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

33
LINES

< > BotCompany Repo | #1007239 - beginCriticalAction - critical actions delay the class's clean-up

JavaX fragment (include)

static L<CriticalAction> beginCriticalAction_inFlight = synchroList();

sclass CriticalAction {
  S description;
  
  *() {}
  *(S *description) {}
  
  void done() {
    beginCriticalAction_inFlight.remove(this);
  }
}

static CriticalAction beginCriticalAction(S description) {
  ping();
  CriticalAction c = new CriticalAction(description);
  beginCriticalAction_inFlight.add(c);
  ret c;
}

svoid cleanMeUp_beginCriticalAction() {
  int n = 0;
  while (nempty(beginCriticalAction_inFlight)) {
    int m = l(beginCriticalAction_inFlight);
    if (m != n) {
      n = m;
      pcall {
        print("Waiting for " + n2(n, "critical actions") + ": " + join(", ", collect(beginCriticalAction_inFlight, "description"));
      }
    }
    sleepInCleanUp(10);
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007239
Snippet name: beginCriticalAction - critical actions delay the class's clean-up
Eternal ID of this version: #1007239/8
Text MD5: 153f16fb10ae478af4d441cb69df1326
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-13 04:04:43
Source code size: 794 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 418 / 459
Version history: 7 change(s)
Referenced in: [show references]