diff options
author | davidxu <davidxu@FreeBSD.org> | 2005-04-02 01:20:00 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2005-04-02 01:20:00 +0000 |
commit | f066519e91e2290cb79ef12fe7c958ee462cda6c (patch) | |
tree | 6aaef5f553a6539306bd6f5679d039ed3c2abcce /lib/libthr/sys | |
parent | 3cc412b7837a105c757df856c422eb5f497bad67 (diff) | |
download | FreeBSD-src-f066519e91e2290cb79ef12fe7c958ee462cda6c.zip FreeBSD-src-f066519e91e2290cb79ef12fe7c958ee462cda6c.tar.gz |
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
Diffstat (limited to 'lib/libthr/sys')
-rw-r--r-- | lib/libthr/sys/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libthr/sys/thr_error.c | 19 |
2 files changed, 9 insertions, 14 deletions
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 <pthread.h> + +#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); } |