summaryrefslogtreecommitdiff
path: root/threads.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-07-30 13:48:12 +0200
committerjmoenig <jens@moenig.org>2013-07-30 13:48:12 +0200
commit15914663173d092dba5498a693c921d94e1aa562 (patch)
treef7afd57f52544775d4ffd7dd8591a6bc0b64d9a2 /threads.js
parent20c1d4d14f3dfb6a50d6d1be3dc47a4ca9cf5921 (diff)
downloadsnap-15914663173d092dba5498a693c921d94e1aa562.tar.gz
snap-15914663173d092dba5498a693c921d94e1aa562.zip
PAUSE primitive command block
Diffstat (limited to 'threads.js')
-rw-r--r--threads.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/threads.js b/threads.js
index 5368b18..0674d94 100644
--- a/threads.js
+++ b/threads.js
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff ////////////////////////////////////////////////////////
-modules.threads = '2013-July-15';
+modules.threads = '2013-July-30';
var ThreadManager;
var Process;
@@ -339,7 +339,7 @@ Process.prototype.runStep = function () {
a step is an an uninterruptable 'atom', it can consist
of several contexts, even of several blocks
*/
- if (this.isPaused) {
+ if (this.isPaused) { // allow pausing in between atomic steps:
return this.pauseStep();
}
this.readyToYield = false;
@@ -348,6 +348,10 @@ Process.prototype.runStep = function () {
&& (this.isAtomic ?
(Date.now() - this.lastYield < this.timeout) : true)
) {
+ // also allow pausing inside atomic steps - for PAUSE block primitive:
+ if (this.isPaused) {
+ return this.pauseStep();
+ }
this.evaluateContext();
}
this.lastYield = Date.now();
@@ -1433,6 +1437,18 @@ Process.prototype.doSetFastTracking = function (bool) {
}
};
+Process.prototype.doPauseAll = function () {
+ var stage, ide;
+ if (this.homeContext.receiver) {
+ stage = this.homeContext.receiver.parentThatIsA(StageMorph);
+ if (stage) {
+ stage.threads.pauseAll(stage);
+ }
+ ide = stage.parentThatIsA(IDE_Morph);
+ if (ide) {ide.controlBar.pauseButton.refresh(); }
+ }
+};
+
// Process loop primitives
Process.prototype.doForever = function (body) {