Fix the pthread_join on self error case.
We should return EDEADLK, not deadlock the calling thread.
Change-Id: I1243483f709c11b2a60e41142725c54c7dbfcbc9
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 9a474c0..479c462 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -80,3 +80,8 @@
ASSERT_EQ(0, pthread_join(t2, &join_result));
ASSERT_EQ(EINVAL, reinterpret_cast<int>(join_result));
}
+
+TEST(pthread, pthread_join_self) {
+ void* result;
+ ASSERT_EQ(EDEADLK, pthread_join(pthread_self(), &result));
+}