[PATCH] D46140: [coroutines] std::task type (WIP)

Lewis Baker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 20 10:35:25 PDT 2018


lewissbaker added inline comments.


================
Comment at: test/std/experimental/task/sync_wait.hpp:36-37
+      __isSet_ = true;
+    }
+    __cv_.notify_all();
+  }
----------------
The call to `notify_all()` needs to be inside the lock.
Otherwise, it's possible the waiting thread may see the write to `__isSet_` inside `wait()` below and return, destroying the `condition_variable` before `__cv_.notify_all()` call completes.


https://reviews.llvm.org/D46140





More information about the cfe-commits mailing list