From c24297c0f24f91427939d0af43da6d12bceb18b5 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Thu, 24 Jul 2003 07:51:49 +0000 Subject: [PATCH] Implement _get_curthread and _set_curthread. We use GCCs builtin function this, which expands to PAL calls (rduniq and wruniq). This needs adjustment when TLS is implemented. --- lib/libthr/arch/alpha/alpha/_curthread.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/libthr/arch/alpha/alpha/_curthread.c b/lib/libthr/arch/alpha/alpha/_curthread.c index c6706e9223fe..56166a77c169 100644 --- a/lib/libthr/arch/alpha/alpha/_curthread.c +++ b/lib/libthr/arch/alpha/alpha/_curthread.c @@ -35,13 +35,18 @@ __FBSDID("$FreeBSD$"); void * _set_curthread(ucontext_t *uc, struct pthread *thread, int *err) { + *err = 0; + if (uc != NULL) + uc->uc_mcontext.mc_thrptr = (uint64_t)thread; + else + __builtin_set_thread_pointer(thread); return (NULL); } struct pthread * _get_curthread(void) { - return (NULL); + return (__builtin_thread_pointer()); } void