This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: problems with pthreads
hi alexey,
> pthread_join(thread1, NULL);
> pthread_join(thread2, NULL);
ok, I think I got this now working.
but why are these lines so important?
and another thing, that confuses me..
my program is going to be a deamon.
1) I switch to deamon mode in a function called 'deamonize()' in which
I use some forking and such. all stdout is going to /dev/null but stderr
goes to a file. works fine by itself!
2) after that I need a few threads.
so I take the lines from the now working example as posted but changed
printf to fprintf(stderr..). works fine by itself!
3) then I want to go on with the application..
when I do step 1 step 2 and forth is not executed (not written in the
file stderr writes to).
when I do step 2 before step 1, step 1 and forth is not executed.
when I skip step 1 and start with step 2, everything works well but not
as a deamon of course.
when I start with step 1 and then leave out step 2, every<thing works
very well (without threads..)
any ideas?
/christian