From eb3cdf876197cbaa66d6f2bfeb6d03ffd4f9a162 Mon Sep 17 00:00:00 2001 From: joerg Date: Sat, 27 Apr 2013 20:36:47 +0000 Subject: [PATCH] Provide stubs for pthread_detach/pthread_join. --- lib/libc/thread-stub/thread-stub.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/libc/thread-stub/thread-stub.c b/lib/libc/thread-stub/thread-stub.c index 466d34761de7..f83f900a1ecd 100644 --- a/lib/libc/thread-stub/thread-stub.c +++ b/lib/libc/thread-stub/thread-stub.c @@ -1,4 +1,4 @@ -/* $NetBSD: thread-stub.c,v 1.25 2013/04/12 18:14:22 joerg Exp $ */ +/* $NetBSD: thread-stub.c,v 1.26 2013/04/27 20:36:47 joerg Exp $ */ /*- * Copyright (c) 2003, 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: thread-stub.c,v 1.25 2013/04/12 18:14:22 joerg Exp $"); +__RCSID("$NetBSD: thread-stub.c,v 1.26 2013/04/27 20:36:47 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ /* @@ -43,6 +43,8 @@ __RCSID("$NetBSD: thread-stub.c,v 1.25 2013/04/12 18:14:22 joerg Exp $"); #define __LIBC_THREAD_STUBS +#define pthread_join __libc_pthread_join +#define pthread_detach __libc_pthread_detach #include "namespace.h" #include "reentrant.h" @@ -67,6 +69,27 @@ do { \ #define CHECK_NOT_THREADED() /* nothing */ #endif +__weak_alias(pthread_join, __libc_pthread_join) +__weak_alias(pthread_detach, __libc_pthread_detach) + +int +pthread_join(pthread_t thread, void **valptr) +{ + + if (thread == pthread_self()) + return EDEADLK; + return ESRCH; +} + +int +pthread_detach(pthread_t thread) +{ + + if (thread == pthread_self()) + return 0; + return ESRCH; +} + /* mutexes */ int __libc_mutex_catchall_stub(mutex_t *);