summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/sys
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2003-04-23 21:46:50 +0000
committerdeischen <deischen@FreeBSD.org>2003-04-23 21:46:50 +0000
commitf8027ceb95ebbec411424424e7be00f63485adb8 (patch)
treeaf28d42652346683148a8b0c30e59e30d9b9b8dd /lib/libpthread/sys
parentb86b779077f57b963024aa4ff279e986002d957b (diff)
downloadFreeBSD-src-f8027ceb95ebbec411424424e7be00f63485adb8.zip
FreeBSD-src-f8027ceb95ebbec411424424e7be00f63485adb8.tar.gz
Protect thread errno from being changed while operating
on behalf of the KSE. Add a kse_reinit function to reinitialize a reused KSE. Submitted by: davidxu
Diffstat (limited to 'lib/libpthread/sys')
-rw-r--r--lib/libpthread/sys/thr_error.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libpthread/sys/thr_error.c b/lib/libpthread/sys/thr_error.c
index a4a8507..6f19f93 100644
--- a/lib/libpthread/sys/thr_error.c
+++ b/lib/libpthread/sys/thr_error.c
@@ -36,14 +36,18 @@
#include <pthread.h>
#include "libc_private.h"
#include "thr_private.h"
+
extern int errno;
-int * __error()
+int *
+__error(void)
{
struct pthread *curthread;
if (__isthreaded == 0)
return (&errno);
+ else if (_kse_in_critical())
+ return &(_get_curkse()->k_error);
else {
curthread = _get_curthread();
if ((curthread == NULL) || (curthread == _thr_initial))
OpenPOWER on IntegriCloud