23 TEST(PThreadTest, pthread_create_and_join) {
24 static std::atomic<bool> hasRun{
false};
25 static std::atomic<int32_t> argPassedIn{0};
26 auto mainFunc = [](
void* arg) ->
void* {
28 argPassedIn = (
int32_t) reinterpret_cast<uintptr_t>(arg);
33 EXPECT_EQ(pthread_create(&thread,
nullptr, mainFunc, (
void*)53), 0);
34 EXPECT_EQ(pthread_join(thread,
nullptr), 0);
39 TEST(PThreadTest, pthread_join_return_value) {
40 static std::atomic<bool> hasRun{
false};
41 auto mainFunc = [](
void*) ->
void* {
47 EXPECT_EQ(pthread_create(&thread,
nullptr, mainFunc,
nullptr), 0);
48 void* exitCode =
nullptr;
49 EXPECT_EQ(pthread_join(thread, &exitCode), 0);
54 TEST(PThreadTest, pthread_equal) {
55 auto self = pthread_self();
58 auto mainFunc = [](
void*) ->
void* {
return nullptr; };
60 EXPECT_EQ(pthread_create(&thread,
nullptr, mainFunc,
nullptr), 0);
61 EXPECT_EQ(pthread_equal(thread,
self), 0);
64 TEST(PThreadTest, pthread_self_on_pthread_thread) {
65 static std::atomic<bool> hasRun{
false};
66 static pthread_t otherSelf;
67 auto mainFunc = [](
void*) ->
void* {
69 otherSelf = pthread_self();
74 EXPECT_EQ(pthread_create(&thread,
nullptr, mainFunc,
nullptr), 0);
75 EXPECT_EQ(pthread_join(thread,
nullptr), 0);
76 EXPECT_NE(pthread_equal(otherSelf, thread), 0);
#define EXPECT_EQ(val1, val2)
TEST(PThreadTest, pthread_create_and_join)
#define EXPECT_TRUE(condition)
#define EXPECT_NE(val1, val2)