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

26
LINES

< > BotCompany Repo | #1010815 // stefansChat_n

JavaX fragment (include)

1  
static volatile int stefansChat_n_value;
2  
static Lock stefansChat_n_lock = lock();
3  
static L stefansChat_n_onChange = synchroList(); // runnables
4  
5  
static int stefansChat_n() {
6  
  ret stefansChat_n_notify(toInt(loadPage("http://botcompany.de/1008998/raw/n")));
7  
}
8  
9  
static int stefansChat_n_notify(int n) {
10  
  bool changed = false;
11  
  if (n > stefansChat_n_value) {
12  
    lock stefansChat_n_lock;
13  
    if (n > stefansChat_n_value) {
14  
      stefansChat_n_value = n;
15  
      changed = true;
16  
    }
17  
  }
18  
  if (changed)
19  
    pcallF_all(stefansChat_n_onChange);
20  
  ret n;
21  
}
22  
23  
svoid stefansChat_n_onChange(O r) {
24  
  if (stefansChat_n_value == 0) stefansChat_n();
25  
  setAdd(stefansChat_n_onChange, r);
26  
}

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: 472 / 496
Version history: 11 change(s)
Referenced in: [show references]