Simple Link problem
I link my program with this
g++ -0 unittest unittest.cpp baseobject.cpp thread.cpp libthread.a which results in Segmentation Fault when being run on pthread_create (&tid, NULL, &my_func, NULL); Why there is seg fault when the linker did not complain? I ran it thru the debugger, i found my_func to be not NULL and tid is 0, what is the problem? is it some dynamic library or static library link problems? Thanks Jack |
tid needs to be set up to point to a valid memory address. pthread_create returns the tread id into this memory address.
graeme |
All times are GMT -5. The time now is 05:03 AM. |