Hello Rooters,
I am trying to launch a thread (using posix thread) that handles
asynchronous events from a root gui. I can avoid a segmentation violation
during the thread's initialization only if I put it to sleep immediately
after I call the thread. Something like this
if (parm1 == 6){
pthread_create(&thread2, NULL,
caMonitorThread, (void *)NULL);
nanosleep(&tenseconds, NULL);
}
but of course when an event gets processed sometime later I will get a
segmentation violation. I guess I don't understand what memory my
TApplication is trying to access while my gui is sitting idly that my
thread is also trying to access.
I should also note that the thread works if run from main like
int main(int argc, char **argv)
{
pthread_mutex_init(&mutex, NULL);
while(1){}
return 0;
}
but fails if
int main(int argc, char **argv)
{
pthread_mutex_init(&mutex, NULL);
pthread_create(&thread2, NULL,
caMonitorThread, (void *)NULL);
TApplication theApp("App", &argc, argv);
theApp.Run();
return 0;
}
Is there something obvious that I should be doing?
Thanks a lot
Adam DeGrush
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:39 MET