From f8027ceb95ebbec411424424e7be00f63485adb8 Mon Sep 17 00:00:00 2001 From: deischen Date: Wed, 23 Apr 2003 21:46:50 +0000 Subject: 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 --- lib/libpthread/sys/thr_error.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/libpthread/sys') 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 #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)) -- cgit v1.1