CJCombrink commented on code in PR #3260:
URL: https://github.com/apache/thrift/pull/3260#discussion_r2575648935


##########
lib/cpp/test/concurrency/ThreadManagerTests.h:
##########
@@ -42,16 +44,7 @@ static void expiredNotifier(std::shared_ptr<Runnable> 
runnable)
 }
 
 static void sleep_(int64_t millisec) {
-  Monitor _sleep;
-  Synchronized s(_sleep);
-
-  try {
-    _sleep.wait(millisec);
-  } catch (TimedOutException&) {
-    ;
-  } catch (...) {
-    assert(0);
-  }
+  boost::this_thread::sleep_for(boost::chrono::milliseconds(millisec));

Review Comment:
   Why `boost::this_thread::sleep_for()` instead of 
`std::this_thread::sleep_for()` which is more curious after mentioning `std::` 
in the PR description?
   
   > Make the test sleep immune to spurious wakeups—e.g., replace sleep_ with 
std::this_thread::sleep_for(std::chrono::milliseconds(timeout)) (approach taken 
in this pull request),
   
   I am guessing using `std::` will remove the need to touch any other file in 
the repo since it seems all of the other touches are to add the boost 
dependency for the test



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to