Commit 7e241566 authored by Orvid King's avatar Orvid King Committed by Facebook Github Bot

Use std::this_thread::yield() rather than sched_yield()

Summary: Because the former is standard and the latter doesn't exist on Windows.

Reviewed By: yfeldblum

Differential Revision: D9565344

fbshipit-source-id: c29c0623c87a20d4c16a29fec1a7311907c1c1cf
parent c7c75855
...@@ -88,7 +88,7 @@ TEST(AsyncFileWriter, simpleMessages) { ...@@ -88,7 +88,7 @@ TEST(AsyncFileWriter, simpleMessages) {
AsyncFileWriter writer{folly::File{tmpFile.fd(), false}}; AsyncFileWriter writer{folly::File{tmpFile.fd(), false}};
for (int n = 0; n < 10; ++n) { for (int n = 0; n < 10; ++n) {
writer.writeMessage(folly::to<std::string>("message ", n, "\n")); writer.writeMessage(folly::to<std::string>("message ", n, "\n"));
sched_yield(); std::this_thread::yield();
} }
} }
tmpFile.close(); tmpFile.close();
...@@ -143,7 +143,7 @@ TEST(AsyncFileWriter, ioError) { ...@@ -143,7 +143,7 @@ TEST(AsyncFileWriter, ioError) {
AsyncFileWriter writer{folly::File{fds[1], true}}; AsyncFileWriter writer{folly::File{fds[1], true}};
for (size_t n = 0; n < numMessages; ++n) { for (size_t n = 0; n < numMessages; ++n) {
writer.writeMessage(folly::to<std::string>("message ", n, "\n")); writer.writeMessage(folly::to<std::string>("message ", n, "\n"));
sched_yield(); std::this_thread::yield();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment