Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve CPU.pause() functionality.

  • Loading branch information...
commit c2db964011452ba9138aada534d48215db7398e8 1 parent e40f10c
@nelhage authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 CPU.js
View
9 CPU.js
@@ -269,14 +269,21 @@ var CPU = {
CPU.run_timer = setTimeout(CPU._run, 0);
},
+ running: function() {
+ return CPU.run_timer !== null;
+ },
+
_run: function() {
+ if (!CPU.run_timer)
+ return;
var i = 0;
while (i++ < 1000 && !CPU.halt)
CPU.step();
if (CPU.halt) {
if (CPU.clock)
clearInterval(CPU.clock);
- if (CPU.config.halt) CPU.config.halt();
+ if (CPU.config.halt)
+ CPU.config.halt();
} else {
setTimeout(CPU._run, 0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.