summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_join.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1998-04-03 09:31:15 +0000
committerJohn Birrell <jb@FreeBSD.org>1998-04-03 09:31:15 +0000
commited92686917250ff0cd818edae39dc79dc0795409 (patch)
treec8efaea56aab15f31cb9144f71c44364e138e8c0 /lib/libpthread/thread/thr_join.c
parent4d2c1d2306f9bf8197b7321352fa2a82ae10e1a6 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_join.c')
-rw-r--r--lib/libpthread/thread/thr_join.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_join.c b/lib/libpthread/thread/thr_join.c
index 63d0d5880bec..9e86a0154b6b 100644
--- a/lib/libpthread/thread/thr_join.c
+++ b/lib/libpthread/thread/thr_join.c
@@ -42,6 +42,16 @@ pthread_join(pthread_t pthread, void **thread_return)
int status;
pthread_t pthread1;
+ /* Check if the caller has specified an invalid thread: */
+ if (pthread == NULL || pthread->magic != PTHREAD_MAGIC)
+ /* Invalid thread: */
+ return(EINVAL);
+
+ /* Check if the caller has specified itself: */
+ if (pthread == _thread_run)
+ /* Avoid a deadlock condition: */
+ return(EDEADLK);
+
/* Block signals: */
_thread_kern_sig_block(&status);