Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/include If thread_create was called with...



details:   https://anonhg.NetBSD.org/src/rev/037f01df4233
branches:  trunk
changeset: 754721:037f01df4233
user:      haad <haad%NetBSD.org@localhost>
date:      Mon May 10 06:26:11 2010 +0000

description:
If thread_create was called with thread_id = NULL use our local thread id
as replacement otherwise we will crash.

diffstat:

 external/cddl/osnet/include/thread.h |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 9a177c981d56 -r 037f01df4233 external/cddl/osnet/include/thread.h
--- a/external/cddl/osnet/include/thread.h      Mon May 10 06:15:28 2010 +0000
+++ b/external/cddl/osnet/include/thread.h      Mon May 10 06:26:11 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: thread.h,v 1.2 2010/05/03 00:31:32 haad Exp $  */
+/*     $NetBSD: thread.h,v 1.3 2010/05/10 06:26:11 haad Exp $  */
 
 /*
  * CDDL HEADER START
@@ -91,9 +91,16 @@
        if(flags & THR_DETACHED)
                pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
+       thread_t th_id;
+       thread_t *t_id;
+       if(new_thread_ID != NULL)
+               t_id = new_thread_ID;
+       else
+               t_id = &th_id;
+
        /* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */
 
-       ret = pthread_create(new_thread_ID, &attr, start_func, arg);
+       ret = pthread_create(t_id, &attr, start_func, arg);
 
        pthread_attr_destroy(&attr);
 



Home | Main Index | Thread Index | Old Index