Re: pthread + malloc = segfault
kai stammerjohann <pro@n5home.de> writes:
> i compile the app (contains c and c++ files) with "gcc -g -O0 -lstdc++ -lpthread ..."
> (the code works under windows and multithreaded c++ libs, so there aren't any faults in the code)
Either that or you got lucky; you might want to try enlisting a memory
checker such as valgrind or Electric Fence to verify that you don't
have a subtle bug.
> should i link to special threadsafe c++ libs (and if, how) ?
Change "-lpthread" to "-pthread" to ensure that your code is compiled
for thread safety.
[Incidentally, this is somewhat off-topic unless you plan to package
the code in question...]
--
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
Finger amu@monk.mit.edu (NOT a valid e-mail address) for more info.
Reply to: