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

22
LINES

< > BotCompany Repo | #1034582 // DoubleVar (never null, stores primitive value, primitive method signatures)

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

Libraryless. Click here for Pure Java version (88L/1K).

sclass DoubleVar {
  double a; // you can access this directly if you use one thread
  
  *() {}
  *(double *a) {}
  
  public synchronized void set(double v) {
    if (v != a) {
      a = v;
      notifyAll();
    }
  }
  
  public synchronized double get() { ret a; }

  synchronized double waitForValue(double x) ctex {
    while (a != x) wait();
    ret a;
  }
  
  toString { ret str(this!); }
}

Author comment

Began life as a copy of #1033409

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034582
Snippet name: DoubleVar (never null, stores primitive value, primitive method signatures)
Eternal ID of this version: #1034582/5
Text MD5: 933a5616f28a6a76f42414405e7582fc
Transpilation MD5: ffaa9966d7b67e35feb67b149e4d9d29
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-19 19:39:54
Source code size: 421 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 143 / 241
Version history: 4 change(s)
Referenced in: [show references]