From f066519e91e2290cb79ef12fe7c958ee462cda6c Mon Sep 17 00:00:00 2001 From: davidxu Date: Sat, 2 Apr 2005 01:20:00 +0000 Subject: Import my recent 1:1 threading working. some features improved includes: 1. fast simple type mutex. 2. __thread tls works. 3. asynchronous cancellation works ( using signal ). 4. thread synchronization is fully based on umtx, mainly, condition variable and other synchronization objects were rewritten by using umtx directly. those objects can be shared between processes via shared memory, it has to change ABI which does not happen yet. 5. default stack size is increased to 1M on 32 bits platform, 2M for 64 bits platform. As the result, some mysql super-smack benchmarks show performance is improved massivly. Okayed by: jeff, mtm, rwatson, scottl --- lib/libthr/sys/Makefile.inc | 4 ++-- lib/libthr/sys/thr_error.c | 19 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'lib/libthr/sys') diff --git a/lib/libthr/sys/Makefile.inc b/lib/libthr/sys/Makefile.inc index 59018f7..70c6dda 100644 --- a/lib/libthr/sys/Makefile.inc +++ b/lib/libthr/sys/Makefile.inc @@ -1,5 +1,5 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/sys ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} +.PATH: ${.CURDIR}/sys -SRCS+= thr_error.c +SRCS+= thr_error.c diff --git a/lib/libthr/sys/thr_error.c b/lib/libthr/sys/thr_error.c index 726c0df..902c054 100644 --- a/lib/libthr/sys/thr_error.c +++ b/lib/libthr/sys/thr_error.c @@ -35,25 +35,20 @@ */ #include + +#include "libc_private.h" #include "thr_private.h" #undef errno extern int errno; -__weak_reference(___error, __error); - int * -___error() +__error(void) { - struct pthread *pthread; - - if (_thread_initial == NULL) - return (&errno); - - pthread = _get_curthread(); + struct pthread *curthread = _get_curthread(); - if (pthread == _thread_initial) + if (curthread != NULL && curthread != _thr_initial) + return (&curthread->error); + else return (&errno); - - return (&pthread->error); } -- cgit v1.1