Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Nov 2004 04:02:12 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 65504 for review
Message-ID:  <200411200402.iAK42CNC004922@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=65504

Change 65504 by davidxu@davidxu_alona on 2004/11/20 04:01:43

	1. simplify code. 2. undef errno.

Affected files ...

.. //depot/projects/davidxu_thread/src/lib/libthread/sys/thr_error.c#2 edit

Differences ...

==== //depot/projects/davidxu_thread/src/lib/libthread/sys/thr_error.c#2 (text+ko) ====

@@ -37,22 +37,16 @@
 #include "libc_private.h"
 #include "thr_private.h"
 
+#undef errno
 extern	int	errno;
 
 int *
 __error(void)
 {
-	struct pthread *curthread;
+	struct pthread *curthread = _get_curthread();
 
-	if (__isthreaded == 0)
+	if (curthread != NULL && curthread != _thr_initial)
+		return (&curthread->error);
+	else
 		return (&errno);
-	else if (_kse_in_critical())
-		return &(_get_curkse()->k_error);
-	else {
-		curthread = _get_curthread();
-		if ((curthread == NULL) || (curthread == _thr_initial))
-			return (&errno);
-		else
-			return (&curthread->error);
-	}
 }



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