Hi,
I need some help with AIX threads. I am trying to use the
pthreads package on 4.1.4.0 system, however the pthreads library
dumps core on the most simple of the calls. Here is the code
for the test case, the program core dumps in the "pthread_attr_init()"
call. Can someone tell me what is going on. Am I using
wrong version of BOS or something else.
---------------------attrtest.c------------------------------
#include <stdio.h>
#include <pthread.h>
main(int argc, char *argv[])
{
pthread_attr_t attr;
int ret = pthread_attr_init(&attr);
return (0);
}
I am using the following line for linking to the pthreads
library
cc -o attrtest.c -o attrtest -lpthreads
thanks in adv for any help,
satyendra
d...@netcom.com
You need to do a little bit more when compiling and linking a MT
program. I assume you are using xlC, so check your configuration
file for proper compiler options for MT, (-D_THREAD_SAFE,
-D_CMA_NOWRAPPERS (don't know if you need this one with 4.x)).
Finally, make sure that you are linking with the reentrant versions of
C library (libc_r), and crt0 (libcrt0_r).
Hope this helps.
Brian.
--
---------------------------------------------------------------------
Drew Csillag dr...@prodigy.com
Prodigy Service 914-448-8187
UNIX and Sendmail Guru programmer/analyst
---------------------------------------------------------------------
Drew> There are two ways to do fix your problem:
Drew> 1) call pthread_init() as your first line of code after the decls in main()
Do not call pthread_init() directly .... pthread_init() is called
from __threads_init() which is called from crt0_r.o. __threads_init()
does more than just call pthread_init() so you would be missing the
rest of the threads initialization.
Drew> 2) use xlC_r (I think it calls pthread_init() in the startup code for you)
The only solution is to call one of the *_r compilers ... please
see the /etc/xlC.cfg file for list.
--
William E. Hannon Jr. internet:wha...@austin.ibm.com
DCE Threads Development whannon@austin
Austin, Texas 78758 Department 905S/9132 Phone:(512)838-3238 T/L(678)
'Confidence is what you had, before you understood the situation.' Dr. Dobson
Tony
--
t...@teleport.COM Public Access User --- Not affiliated with Teleport
Public Access UNIX and Internet at (503) 220-1016 (2400-28800, N81)