From 800802c8573781c591c39d4ea580938a9cd2e8a0 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Mon, 1 Aug 2016 13:17:30 -0700 Subject: [PATCH] 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 --- folly/io/async/test/AsyncSocketTest2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/folly/io/async/test/AsyncSocketTest2.cpp b/folly/io/async/test/AsyncSocketTest2.cpp index 5e548c1e..9876da6c 100644 --- a/folly/io/async/test/AsyncSocketTest2.cpp +++ b/folly/io/async/test/AsyncSocketTest2.cpp @@ -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, -- 2.34.1