You are not logged in.
I have created a quite large program under windows and now I am porting it to linux and uinx.
Under linux everything is working perfectly.
But under unix...
When I create a thread with pthread_create the thread dosen't start until I in the end of the program when I call pthread_join.
I find this really wierd because I tested these functions in a much simpler program and it all worked fine.
Does anyone have a solution or even a hint what's wrong?
I am not really a threading or pthread guru, however, you might want to mention what you mean by "unix". The term Unix is owned by the Open Group and they let people apply such to any product that meets their Unix standard specifications (which are now developed jointly with IEEE POSIX). I believe Unix, can and does refer to some versions of Linux in fact, however there are a number of Unix-like OS venders that have obtained Unix standardization and thus use that name and I presume you are referring to one of such platforms.
Another question that was never fully answered... nevermind that its from 2004... :)
A number of systems / *NIX OSes set the default concurrency level for threading equal to the number of processors available on the system e.g. 1 processor means a concurrency level of 1 and ONLY a single thread will execute at a time... 2 processors would allow ( only ) 2 threads to run simultaneously...
So I am guessing this is what you are seeing... the concurrency level is defaulting to 1 ( or something very low ) and the first thread executes... your main program does a join against it... and when ( and only when ) the join finishes indicating the first thread has completed - does the next one get to begin execution...
If you run into this check for the existence of either pthread_setconcurrency or thread_setconcurrency on you system... and call the function with the desired number of threads you want to execute simultaneously...
We now return you all to 2008... :)
"The only difference between me and a madman is that I'm not mad."
Salvador Dali (1904-1989)
Virgin wranglerNot only was Zarqawi killed, but so were seven of his cronies... making it a good day for the U.S. military, but a bad day to be a virgin wrangler in Muslim heaven. Eight martyrs, 72 apiece? That's nearly 600 virgins needed, stat. My guess is some of the lower ranking guys might not be getting a full compliment if you know what I'm saying. I think the cherry orchard may have a couple bruised fruits. 111