Auto merge of #26998 - gterzian:improve_task_cancelling, r=jdm

Use a stronger atomic guarantee when cancelling tasks

<!-- Please describe your changes on the following line: -->

In the context of https://github.com/servo/servo/issues/22507

Note that the "other side" of these operations is at 0b61cfc3ae/components/script/task.rs (L102)

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-07-06 11:11:25 -04:00 committed by GitHub
commit 1cd78e78f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -399,7 +399,7 @@ impl Window {
let flag = ignore_flags let flag = ignore_flags
.entry(task_source_name) .entry(task_source_name)
.or_insert(Default::default()); .or_insert(Default::default());
flag.store(true, Ordering::Relaxed); flag.store(true, Ordering::SeqCst);
} }
} }
@ -1431,7 +1431,7 @@ impl Window {
.entry(task_source_name) .entry(task_source_name)
.or_insert(Default::default()); .or_insert(Default::default());
let cancelled = mem::replace(&mut *flag, Default::default()); let cancelled = mem::replace(&mut *flag, Default::default());
cancelled.store(true, Ordering::Relaxed); cancelled.store(true, Ordering::SeqCst);
} }
} }
@ -1444,7 +1444,7 @@ impl Window {
.entry(task_source_name) .entry(task_source_name)
.or_insert(Default::default()); .or_insert(Default::default());
let cancelled = mem::replace(&mut *flag, Default::default()); let cancelled = mem::replace(&mut *flag, Default::default());
cancelled.store(true, Ordering::Relaxed); cancelled.store(true, Ordering::SeqCst);
} }
pub fn clear_js_runtime(&self) { pub fn clear_js_runtime(&self) {