diff options
author | Brian Behlendorf <[email protected]> | 2010-08-26 10:43:27 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-08-31 08:38:47 -0700 |
commit | 1e33ac1e2677c898a0b5ef6207048c692cb51bf4 (patch) | |
tree | ae64d55d71c7d3ff46a8b79aed0c8081f2ba965c /lib/libuutil | |
parent | 8a8f5c6b3ca44248b47a4a65515d7828803c71ff (diff) |
Fix Solaris thread dependency by using pthreads
This is a portability change which removes the dependence of the Solaris
thread library. All locations where Solaris thread API was used before
have been replaced with equivilant Solaris kernel style thread calls.
In user space the kernel style threading API is implemented in term of
the portable pthreads library. This includes all threads, mutexs,
condition variables, reader/writer locks, and taskqs.
Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'lib/libuutil')
-rw-r--r-- | lib/libuutil/uu_misc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libuutil/uu_misc.c b/lib/libuutil/uu_misc.c index 578bf3294..1b843effe 100644 --- a/lib/libuutil/uu_misc.c +++ b/lib/libuutil/uu_misc.c @@ -34,7 +34,6 @@ #include <stdlib.h> #include <string.h> #include <sys/debug.h> -#include <thread.h> #include <unistd.h> #include <ctype.h> @@ -68,11 +67,12 @@ static va_list uu_panic_args; static pthread_t uu_panic_thread; static uint32_t _uu_main_error; +static __thread int _uu_main_thread = 0; void uu_set_error(uint_t code) { - if (thr_main() != 0) { + if (_uu_main_thread) { _uu_main_error = code; return; } @@ -101,7 +101,7 @@ uu_set_error(uint_t code) uint32_t uu_error(void) { - if (thr_main() != 0) + if (_uu_main_thread) return (_uu_main_error); if (uu_error_key_setup < 0) /* can't happen? */ @@ -259,6 +259,7 @@ uu_init(void) __attribute__((constructor)); static void uu_init(void) { + _uu_main_thread = 1; (void) pthread_atfork(uu_lockup, uu_release, uu_release_child); } |