Use atomic wait/notify on RXTAIL in KEY
This commit is contained in:
2
emu.js
2
emu.js
@@ -27,6 +27,7 @@ class Emulator {
|
||||
this.mem_u8 = new Uint8Array(this.mem.buffer);
|
||||
for (let i = 0; i < PERIPHS_SIZE; ++i)
|
||||
this.mem_u8[i] = 0;
|
||||
this.mem_i32 = new Int32Array(this.mem.buffer);
|
||||
|
||||
this.decoder = new TextDecoder('utf-8');
|
||||
this.encoder = new TextEncoder('utf-8');
|
||||
@@ -103,6 +104,7 @@ class Emulator {
|
||||
tail = this.fifo_next(tail);
|
||||
} while (this.fifo_next(tail) != head && this.rx_queue.length != 0);
|
||||
Atomics.store(this.mem_u8, RXTAIL, tail);
|
||||
Atomics.notify(this.mem_i32, RXTAIL / 4);
|
||||
}
|
||||
|
||||
print(str) {
|
||||
|
||||
Reference in New Issue
Block a user