title: how does pthread_join populate the variable of thread_result
body: <p>Note: I have removed all required error checking in the following snippet.</p>
  
  <pre><code>...
  void *thread_function(void *arg)
  {
     ...
     pthread_exit("Hello");
  }
  
  pthread_t a_thread;
  void *thread_result;
  
  pthread_create(&amp;a_thread, NULL, thread_function, NULL);
  pthread_join(a_thread, &amp;thread_result);
  /*
  
  int pthread_join(pthread_t th, void **thread_return);
  The second argument is a pointer to a pointer that itself points to the return
  value from the thread.
  
  int pthread_exit(void *retval);
  This function terminates the calling thread, returning a pointer to an object which
  cannot be a local variable.
  
  */
  </code></pre>
  
  <p><strong>Question</strong>: how does pthread_join populate the variable of thread_result?
  Since the variable thread_result has no allocated space to hold information,
  if pthread_join allocates space for thread_result, then major thread must
  deallocate the resource holding by the varable. As you can see, the code doesn't
  include the deallocation resource of thread_result. So I assume that pthread_join
  in fact doesn't allocate space for thread_result.</p>
  
  <p>Now the new question is how the variable thread_result can contain information without
  being allocated any space?</p>
  
  <p>//Update-1: Add the definition of pthread_exit.</p>
  
  <p>//Update-2: Add the definition of thread_function.</p>