mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 21:11:40 +00:00
[test] Fix data race in samples/ffi/async/async_test.
TEST=tsan Bug: https://github.com/dart-lang/sdk/issues/55615 Change-Id: I4de5701037640f5b0ae6b176f695907c4c5e1ef5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365209 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
25a309a85c
commit
ed5aeab889
|
@ -480,9 +480,10 @@ intptr_t MyCallbackBlocking(intptr_t a) {
|
|||
auto callback = my_callback_blocking_fp_; // Define storage duration.
|
||||
std::condition_variable cv;
|
||||
bool notified = false;
|
||||
const Work work = [a, &result, callback, &cv, ¬ified]() {
|
||||
const Work work = [a, &result, callback, &mutex, &cv, ¬ified]() {
|
||||
result = callback(a);
|
||||
printf("C Da: Notify result ready.\n");
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
notified = true;
|
||||
cv.notify_one();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue