Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2005 12:53:25 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 68313 for review
Message-ID:  <200501051253.j05CrPH8010634@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501051253.j05CrPH8010634>