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

26
LINES

< > BotCompany Repo | #1010815 // stefansChat_n

JavaX fragment (include)

static volatile int stefansChat_n_value;
static Lock stefansChat_n_lock = lock();
static L stefansChat_n_onChange = synchroList(); // runnables

static int stefansChat_n() {
  ret stefansChat_n_notify(toInt(loadPage("http://botcompany.de/1008998/raw/n")));
}

static int stefansChat_n_notify(int n) {
  bool changed = false;
  if (n > stefansChat_n_value) {
    lock stefansChat_n_lock;
    if (n > stefansChat_n_value) {
      stefansChat_n_value = n;
      changed = true;
    }
  }
  if (changed)
    pcallF_all(stefansChat_n_onChange);
  ret n;
}

svoid stefansChat_n_onChange(O r) {
  if (stefansChat_n_value == 0) stefansChat_n();
  setAdd(stefansChat_n_onChange, r);
}

Author comment

Began life as a copy of #1010756

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010815
Snippet name: stefansChat_n
Eternal ID of this version: #1010815/12
Text MD5: b8c642c64b5356467f9a8a2ac0a204fd
Author: stefan
Category: javax / chat
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-14 05:56:28
Source code size: 700 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 471 / 495
Version history: 11 change(s)
Referenced in: [show references]