From owner-p4-projects@FreeBSD.ORG Wed Jan 5 12:53:26 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B418216A4D0; Wed, 5 Jan 2005 12:53:25 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B0D216A4CE for ; Wed, 5 Jan 2005 12:53:25 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 63BC243D55 for ; Wed, 5 Jan 2005 12:53:25 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j05CrPOj010637 for ; Wed, 5 Jan 2005 12:53:25 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j05CrPH8010634 for perforce@freebsd.org; Wed, 5 Jan 2005 12:53:25 GMT (envelope-from davidxu@freebsd.org) Date: Wed, 5 Jan 2005 12:53:25 GMT Message-Id: <200501051253.j05CrPH8010634@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 68313 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jan 2005 12:53:26 -0000 http://perforce.freebsd.org/chv.cgi?CH=68313 Change 68313 by davidxu@davidxu_tiger on 2005/01/05 12:53:18 To be consistent, just use _thr_initial to test if library has been initialized. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/arch/alpha/alpha/pthread_md.c#3 edit .. //depot/projects/davidxu_thread/src/lib/libthread/arch/alpha/include/pthread_md.h#3 edit .. //depot/projects/davidxu_thread/src/lib/libthread/arch/amd64/include/pthread_md.h#4 edit .. //depot/projects/davidxu_thread/src/lib/libthread/arch/i386/include/pthread_md.h#4 edit .. //depot/projects/davidxu_thread/src/lib/libthread/arch/ia64/include/pthread_md.h#4 edit .. //depot/projects/davidxu_thread/src/lib/libthread/arch/sparc64/include/pthread_md.h#3 edit .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_init.c#7 edit .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_private.h#13 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/arch/alpha/alpha/pthread_md.c#3 (text+ko) ==== @@ -42,7 +42,6 @@ if ((tcb = malloc(sizeof(struct tcb))) != NULL) { tcb->tcb_thread = thread; } - printf("tcb=%p\n", tcb); return (tcb); } ==== //depot/projects/davidxu_thread/src/lib/libthread/arch/alpha/include/pthread_md.h#3 (text+ko) ==== @@ -38,7 +38,7 @@ struct tdv; /* We don't know what this is yet? */ struct tcb { - struct tdv *tp_tdv; /* dynamic TLS */ + struct tdv *tcb_tdv; /* dynamic TLS */ struct pthread *tcb_thread; }; @@ -68,12 +68,12 @@ return (_tcb); } -extern int _thread_inited; +extern struct pthread *_thr_initial; static __inline struct pthread * _get_curthread(void) { - if (_thread_inited) + if (_thr_initial) return (_tcb->tcb_thread); return (NULL); } ==== //depot/projects/davidxu_thread/src/lib/libthread/arch/amd64/include/pthread_md.h#4 (text+ko) ==== @@ -99,13 +99,13 @@ return (TCB_GET64(tcb_self)); } -extern int _thread_inited; +extern struct pthread *_thr_initial; /* Get the current thread. */ static __inline struct pthread * _get_curthread(void) { - if (_thread_inited) + if (_thr_initial) return (TCB_GET64(tcb_thread)); return (NULL); } ==== //depot/projects/davidxu_thread/src/lib/libthread/arch/i386/include/pthread_md.h#4 (text+ko) ==== @@ -103,13 +103,13 @@ return (TCB_GET32(tcb_self)); } -extern int _thread_inited; +extern struct pthread *_thr_initial; /* Get the current thread. */ static __inline struct pthread * _get_curthread(void) { - if (_thread_inited) + if (_thr_initial) return (TCB_GET32(tcb_thread)); return (NULL); } ==== //depot/projects/davidxu_thread/src/lib/libthread/arch/ia64/include/pthread_md.h#4 (text+ko) ==== @@ -65,12 +65,12 @@ return (_tcb); } -extern int _thread_inited; +extern struct pthread *_thr_initial; static __inline struct pthread * _get_curthread(void) { - if (_thread_inited) + if (_thr_initial) return (_tcb->tcb_thread); return (NULL); } ==== //depot/projects/davidxu_thread/src/lib/libthread/arch/sparc64/include/pthread_md.h#3 (text+ko) ==== @@ -72,12 +72,12 @@ return (_tcb); } -extern int _thread_inited; +extern struct pthread *_thr_initial; static __inline struct pthread * _get_curthread(void) { - if (_thread_inited) + if (_thr_initial) return (_tcb->tcb_thread); return (NULL); } ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_init.c#7 (text+ko) ==== @@ -282,11 +282,10 @@ _tcb_set(curthread->tcb); if (first) { - _thr_initial = curthread; SIGFILLSET(sigset); __sys_sigprocmask(SIG_SETMASK, &sigset, &oldset); _thr_signal_init(); - _thread_inited = 1; + _thr_initial = curthread; SIGDELSET(oldset, SIGCANCEL); __sys_sigprocmask(SIG_SETMASK, &oldset, NULL); } ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_private.h#13 (text+ko) ==== @@ -630,7 +630,6 @@ SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL); /* For debugger */ SCLASS int _libkse2_debug SCLASS_PRESET(0); -SCLASS int _thread_inited SCLASS_PRESET(0); SCLASS int _thread_scope_system SCLASS_PRESET(0); /* List of all threads: */ @@ -849,13 +848,13 @@ static inline int _thr_is_inited(void) { - return _thread_inited; + return (_thr_initial != 0); } static inline void _thr_check_init(void) { - if (_thread_inited == 0) + if (_thr_initial == 0) _libpthread_init(0); }