Dziwna kolejność wykonywania wątków w C ++

Próbowałem wykonać pierwszy przykład zLinux Tutorial Wątki Posix. Oto co mam:

<code>[alex@Allok c_c++]$ g++ -lpthread from.cpp
from.cpp: In function ‘int main()’:
from.cpp:10:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
from.cpp:11:22: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
[alex@Allok c_c++]$ ./a.out 
Thread 2 
Thread 1 
Thread 1 returns: 0
Thread 2 returns: 0
</code>

Problem polega na tym, że spodziewałem się, że dane wyjściowe będą takie jak w źródle:

<code>Thread 1
Thread 2
Thread 1 returns: 0
Thread 2 returns: 0
</code>

Nie rozumiem, dlaczego tak się dzieje. Czy ktoś może mi pomóc?

<code>[alex@Allok c_c++]$ uname -a
Linux Allok 3.3.2-1-ARCH #1 SMP PREEMPT Sat Apr 14 10:08:43 UTC 2012 i686 AMD Athlon(tm) II Neo K125 Processor AuthenticAMD GNU/Linux
</code>

questionAnswers(1)

yourAnswerToTheQuestion