Backed out changeset 9110f18c19aa (bug 1125989)

This commit is contained in:
Andrew Sutherland
2015-02-24 13:46:27 -05:00
parent c3331e1cac
commit 20ebe06333
3 changed files with 22 additions and 126 deletions

View File

@@ -268,39 +268,36 @@ let Scheduler = {
// Grab the kill queue to make sure that we
// cannot be interrupted by another call to `kill`.
let killQueue = this._killQueue;
// Deactivate the queue, to ensure that no message is sent
// to an obsolete worker (we reactivate it in the `finally`).
// This needs to be done right now so that we maintain relative
// ordering with calls to post(), etc.
let deferred = Promise.defer();
let savedQueue = this.queue;
this.queue = deferred.promise;
return this._killQueue = Task.spawn(function*() {
yield killQueue;
// From this point, and until the end of the Task, we are the
// only call to `kill`, regardless of any `yield`.
yield savedQueue;
yield this.queue;
// Enter critical section: no yield in this block
// (we want to make sure that we remain the only
// request in the queue).
if (!this.launched || this.shutdown || !this._worker) {
// Nothing to kill
this.shutdown = this.shutdown || shutdown;
this._worker = null;
return null;
}
// Deactivate the queue, to ensure that no message is sent
// to an obsolete worker (we reactivate it in the |finally|).
let deferred = Promise.defer();
this.queue = deferred.promise;
// Exit critical section
let message = ["Meta_shutdown", [reset]];
try {
// Enter critical section: no yield in this block
// (we want to make sure that we remain the only
// request in the queue).
if (!this.launched || this.shutdown || !this._worker) {
// Nothing to kill
this.shutdown = this.shutdown || shutdown;
this._worker = null;
return null;
}
// Exit critical section
let message = ["Meta_shutdown", [reset]];
Scheduler.latestReceived = [];
Scheduler.latestSent = [Date.now(), ...message];