Module Name:    src
Committed By:   joerg
Date:           Sat Apr 27 20:36:47 UTC 2013

Modified Files:
        src/lib/libc/thread-stub: thread-stub.c

Log Message:
Provide stubs for pthread_detach/pthread_join.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/thread-stub/thread-stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/thread-stub/thread-stub.c
diff -u src/lib/libc/thread-stub/thread-stub.c:1.25 src/lib/libc/thread-stub/thread-stub.c:1.26
--- src/lib/libc/thread-stub/thread-stub.c:1.25	Fri Apr 12 18:14:22 2013
+++ src/lib/libc/thread-stub/thread-stub.c	Sat Apr 27 20:36:47 2013
@@ -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 <sys/cdefs.h>
 #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 2
 
 #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 *);

Reply via email to