| Index: mojo/edk/system/awakable_list.cc
|
| diff --git a/mojo/edk/system/awakable_list.cc b/mojo/edk/system/awakable_list.cc
|
| index 510b88a3551fd3c02e0727d19d2aee758cd7a49b..e419d40383a2e08be8101e05287178643fb49ef6 100644
|
| --- a/mojo/edk/system/awakable_list.cc
|
| +++ b/mojo/edk/system/awakable_list.cc
|
| @@ -70,5 +70,20 @@ void AwakableList::Remove(Awakable* awakable) {
|
| awakables_.erase(last, awakables_.end());
|
| }
|
|
|
| +void AwakableList::RemoveWithContext(Awakable* awakable, uint64_t context) {
|
| + // We allow a thread to wait on the same handle multiple times simultaneously,
|
| + // so we need to scan the entire list and remove all occurrences of |waiter|.
|
| + auto last = awakables_.end();
|
| + for (AwakeInfoList::iterator it = awakables_.begin(); it != last;) {
|
| + if (it->awakable == awakable && it->context == context) {
|
| + --last;
|
| + std::swap(*it, *last);
|
| + } else {
|
| + ++it;
|
| + }
|
| + }
|
| + awakables_.erase(last, awakables_.end());
|
| +}
|
| +
|
| } // namespace system
|
| } // namespace mojo
|
|
|