1 THRD_JOIN(3C)            Standard C Library Functions            THRD_JOIN(3C)
   2 
   3 NAME
   4      thrd_join - wait for thread termination
   5 
   6 SYNOPSIS
   7      #include <threads.h>
   8 
   9      int
  10      thrd_join(thrd_t thrd, int *res);
  11 
  12 DESCRIPTION
  13      The thrd_join() function suspends the execution of the current thread and
  14      waits for the thread indicated by thrd to terminate and stores the exit
  15      status, as set by a call to thrd_exit(3C), for that thread in res, if res
  16      is non-null.  The thrd argument must be a member of the current process
  17      and it cannot be detached.  If thrd has already terminated and another
  18      caller has not called thrd_join() then the exit status will be returned
  19      to the caller without blocking execution of the thread.
  20 
  21      If multiple threads call thrd_join() on the same thread, then both will
  22      be suspended until that thread terminates; however, only one thread will
  23      return successfully and obtain the actual status and the other will
  24      instead return with an error.
  25 
  26      For additional information on the thread joining interfaces supported by
  27      the system, see pthread_join(3C) and thr_join(3C).
  28 
  29 RETURN VALUES
  30      Upon successful completion, the thrd_join() function returns thrd_success
  31      and if res is a non-null pointer, it will be filled in with the exit
  32      status of thrd.  If an error occurs, thrd_error will be returned.
  33 
  34 INTERFACE STABILITY
  35      Standard
  36 
  37 MT-LEVEL
  38      MT-Safe
  39 
  40 SEE ALSO
  41      pthread_join(3C), thrd_create(3C), thrd_detach(3C), attributes(5),
  42      threads(5)
  43 
  44 illumos                         August 27, 2019                        illumos