libbsd - Advice Request on pthread_main_np
Joel Sherrill
joel.sherrill at OARcorp.com
Mon Sep 10 21:36:16 UTC 2012
Hi
freebsd-userspace/lib/libc/include/nss_tls.h has the following
conditional:
\
if (!__isthreaded || _pthread_main_np() != 0) { \
*p = &st; \
return (0); \
} \
We have defined __isthreaded to "1" to indicate we are always
in a multithreaded program.
pthread_main_np() returns -1 to indicate that this is the "main thread".
The combination basically says we are threaded and running in the
first thread.
This is only used in the following libc methods:
./freebsd-userspace/lib/libc/net/getprotoname.c
./freebsd-userspace/lib/libc/net/nsdispatch.c
./freebsd-userspace/lib/libc/net/getprotoent.c
./freebsd-userspace/lib/libc/net/getservent.c
./freebsd-userspace/lib/libc/net/getproto.c
How do we map that conditional expression to RTEMS to ensure we
only initialize these one.
FWIW almost the entire nss_tls.h is a macro. So changing those two
lines will result in about 40 lines needing to be in the conditional block.
Suggestions appreciated on a semantic and coding solution.
--
Joel Sherrill, Ph.D. Director of Research& Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel
mailing list