When a program creates detached threads (using Posix threads), does the new thread inherit the memory space of the parent? I am creating the threads detached, but when I try to use some memory that was created by the parent thread, the program crashes with a memory error. Do processes need to be created not detached (attached) in order to use the parent's memory space? I am compiling this C++ code with gcc 3.4.2 on an HP-UX 11.00 32 bit machine. The exact code works on both Linux and Solaris, so I'm wondering if this is an HPUX problem or something that I just got away with on the other 2 OS's. Here is how I"m creating the threads:
int ret = pthread_create(&tid, &thAttrs, MyFunc, (void *)myPtr);
If I run the exact code single threaded, the crash disappears. Any help is appreciated.