Libraryless. Click here for Pure Java version (88L/1K).
1 | sclass DoubleVar {
|
2 | double a; // you can access this directly if you use one thread |
3 | |
4 | *() {}
|
5 | *(double *a) {}
|
6 | |
7 | public synchronized void set(double v) {
|
8 | if (v != a) {
|
9 | a = v; |
10 | notifyAll(); |
11 | } |
12 | } |
13 | |
14 | public synchronized double get() { ret a; }
|
15 | |
16 | synchronized double waitForValue(double x) ctex {
|
17 | while (a != x) wait(); |
18 | ret a; |
19 | } |
20 | |
21 | toString { ret str(this!); }
|
22 | } |
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: | 601 / 745 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |