cyb70289 commented on a change in pull request #9720:
URL: https://github.com/apache/arrow/pull/9720#discussion_r595710856
##########
File path: cpp/src/arrow/testing/gtest_util.cc
##########
@@ -769,10 +770,8 @@ class GatingTask::Impl {
}
Status Unlock() {
- {
- std::lock_guard<std::mutex> lk(mx_);
- unlocked_ = true;
- }
+ std::lock_guard<std::mutex> lk(mx_);
Review comment:
Looks it's better to release the lock before calling cv.notify_all()?
https://en.cppreference.com/w/cpp/thread/condition_variable/notify_all
```
The notifying thread does not need to hold the lock on the same mutex as the
one held by the waiting thread(s); in fact doing so is a pessimization, since
the notified thread would immediately block again, waiting for the notifying
thread to release the lock.
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]