Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/thread-stub Provide stubs for pthread_detach/pthrea...



details:   https://anonhg.NetBSD.org/src/rev/03f5e31e4475
branches:  trunk
changeset: 786386:03f5e31e4475
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Apr 27 20:36:47 2013 +0000

description:
Provide stubs for pthread_detach/pthread_join.

diffstat:

 lib/libc/thread-stub/thread-stub.c |  27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r 8f6f731d016e -r 03f5e31e4475 lib/libc/thread-stub/thread-stub.c
--- a/lib/libc/thread-stub/thread-stub.c        Sat Apr 27 20:13:16 2013 +0000
+++ b/lib/libc/thread-stub/thread-stub.c        Sat Apr 27 20:36:47 2013 +0000
@@ -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 @@
 
 #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 @@
 #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 *);



Home | Main Index | Thread Index | Old Index