title: Does or does not pthread_join() allow execution on calling thread to continue?
body: <p><strong>edit:</strong>
  I made the wrong assumption that threads started running on <code>pthread_join</code> when they actually start running on <code>pthread_create</code>.  </p>
  
  <hr>
  
  <p>I'm learning to use Posix threads, and I've read that:<br>
  <code>pthread_join() - wait for thread termination</code></p>
  
  <p>So, in the code sample, main's exit(0) is not reached until both started threads end.<br>
  But after the first call to pthread_join(), main continues executing, because the second call to pthread_join() actually runs, and the message in between is printed.<br>
  So how's this? does main continue executing while both threads aren't finished yet? or doesn't it?<br>
  I know this isn't a reliable way of testing, but the second test message always gets printed after both threads are finished, no matter how long the loop is. (at least on my machine when I tried it)<br>
  <code><pre>
  void *print_message_function( void *ptr )
  {
      char *message = (char *) ptr;
      for( int a = 0; a &lt; 1000; ++a )
          printf( "%s - %i\n", message, a );
      return NULL;
  }
  //
  int main( int argc, char *argv[] )
  {
      pthread_t thread1, thread2;
      char message1[] = "Thread 1";
      char message2[] = "Thread 2";
      int  iret1, iret2;
      //
      iret1 = pthread_create( &amp;thread1, NULL, print_message_function, (void*) message1);
      iret2 = pthread_create( &amp;thread2, NULL, print_message_function, (void*) message2);
      //
      pthread_join( thread1, NULL);
      printf( "Let's see when is this printed...\n" );
      pthread_join( thread2, NULL); 
      printf( "And this one?...\n" );
      //
      printf("Thread 1 returns: %d\n",iret1);
      printf("Thread 2 returns: %d\n",iret2);
      exit(0);
  }
  </pre></code></p>