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

26
LINES

< > BotCompany Repo | #1011980 // smartBotsChat_n

JavaX fragment (include)

static volatile int smartBotsChat_n_value;
static Lock smartBotsChat_n_lock = lock();
static L smartBotsChat_n_onChange = synchroList(); // runnables

static int smartBotsChat_n() {
  ret smartBotsChat_n_notify(toInt(loadPage("http://botcompany.de/1011975/raw/n")));
}

static int smartBotsChat_n_notify(int n) {
  bool changed = false;
  if (n > smartBotsChat_n_value) {
    lock smartBotsChat_n_lock;
    if (n > smartBotsChat_n_value) {
      smartBotsChat_n_value = n;
      changed = true;
    }
  }
  if (changed)
    pcallF_all(smartBotsChat_n_onChange);
  ret n;
}

svoid smartBotsChat_n_onChange(O r) {
  if (smartBotsChat_n_value == 0) smartBotsChat_n();
  setAdd(smartBotsChat_n_onChange, r);
}

Author comment

Began life as a copy of #1010815

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: #1011980
Snippet name: smartBotsChat_n
Eternal ID of this version: #1011980/1
Text MD5: 540505782be2c5a9e8311158adfccab3
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 03:42:45
Source code size: 730 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 429 / 454
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)