diff options
author | deischen <deischen@FreeBSD.org> | 2003-04-23 21:46:50 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-04-23 21:46:50 +0000 |
commit | f8027ceb95ebbec411424424e7be00f63485adb8 (patch) | |
tree | af28d42652346683148a8b0c30e59e30d9b9b8dd /lib/libpthread/sys/thr_error.c | |
parent | b86b779077f57b963024aa4ff279e986002d957b (diff) | |
download | FreeBSD-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/thr_error.c')
-rw-r--r-- | lib/libpthread/sys/thr_error.c | 6 |
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)) |