Commit 800802c8 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 2

Switch some assertions to std::thread rather than pthread

Summary: Because the check macros attempt to pipe the values to the error stream, but we can't do that with the Windows implementation. Switch to `std::this_thread::get_id()` instead because it's standard and can be piped.

Reviewed By: djwatson

Differential Revision: D3650362

fbshipit-source-id: 8af65448a33949f310abc818d95bac843214b685
parent 27945a69
......@@ -1949,18 +1949,18 @@ TEST(AsyncSocketTest, OtherThreadAcceptCallback) {
// Add several accept callbacks
TestAcceptCallback cb1;
auto thread_id = pthread_self();
auto thread_id = std::this_thread::get_id();
cb1.setAcceptStartedFn([&](){
CHECK_NE(thread_id, pthread_self());
thread_id = pthread_self();
CHECK_NE(thread_id, std::this_thread::get_id());
thread_id = std::this_thread::get_id();
});
cb1.setConnectionAcceptedFn(
[&](int /* fd */, const folly::SocketAddress& /* addr */) {
CHECK_EQ(thread_id, pthread_self());
CHECK_EQ(thread_id, std::this_thread::get_id());
serverSocket->removeAcceptCallback(&cb1, nullptr);
});
cb1.setAcceptStoppedFn([&](){
CHECK_EQ(thread_id, pthread_self());
CHECK_EQ(thread_id, std::this_thread::get_id());
});
// Test having callbacks remove other callbacks before them on the list,
......
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