Index: src/cancelable-task.cc |
diff --git a/src/cancelable-task.cc b/src/cancelable-task.cc |
index 5927c22cdeb20b18081b4cdcdacbc6c3977ee72e..3413d459abe692d659e7ed320e3616e988d6f984 100644 |
--- a/src/cancelable-task.cc |
+++ b/src/cancelable-task.cc |
@@ -12,13 +12,15 @@ namespace internal { |
Cancelable::Cancelable(Isolate* isolate) |
- : isolate_(isolate), is_cancelled_(false) { |
+ : isolate_(isolate), status_(kWaiting) { |
Hannes Payer (out of office)
2015/11/04 23:19:00
atomic set?
|
isolate->RegisterCancelableTask(this); |
} |
Cancelable::~Cancelable() { |
- if (!is_cancelled_) { |
+ if (CanRun() || IsRunning() || IsCanceled()) { |
Hannes Payer (out of office)
2015/11/04 23:19:00
Why would you CanRun here?
|
+ // Get exclusive access here to avoid a race with the isolate when calling |
+ // {CancelForShutdown}. |
isolate_->RemoveCancelableTask(this); |
} |
} |