Home | History | Annotate | Download | only in pthread_create
      1 <assertions>
      2   <assertion id="1" tag="ref:XSH6:32840:32842">
      3    The
      4 
      5    int pthread_create(pthread_t *restrict thread, const pthread_attr_t
      6   	*restrict attr, void *(*start_routine) (void*), void *restrict arg);
      7 
      8    creates a new thread, with attributes specified
      9    by 'attr', within a process.
     10   </assertion>
     11   <assertion id="2" tag="ref:XSH6:32842:32842">
     12    If 'attr' is NULL, the default attributes shall be used.
     13    The attribute that will be tested is the detached state, because that is
     14    the only state that has a default listed in the specification.
     15 
     16    default: PTHREAD_CREATE_JOINABLE
     17    Other valid values: PTHREAD_CREATE_DETACHED
     18 
     19   </assertion>
     20   <assertion id="3" tag="ref:XSH6:32842:32843">
     21    If the attributes specified by 'attr' are modified later after the thread
     22    is create, the thread's attributes should not be affected.
     23   </assertion>
     24   <assertion id="4" tag="ref:XSH6:32843:32844">
     25    If success, pthread_create() will store the ID of the
     26    the created thread in the location referenced by 'thread'.
     27   </assertion>
     28   <assertion id="5" tag="ref:XSH6:32845:32845">
     29    The thread is created executing 'start_routine' with 'arg' as its only
     30    argument.
     31   </assertion>
     32   <assertion id="6" tag="ref:XSH6:32845:32848">
     33   If the 'start_routine' returns, the effect shall be as if there was an
     34   implicit call to pthread_exit() using the return value of 'start_routine'
     35   as the exit status.
     36   NOTE: that the thread in which main() was originally invoked is different
     37   from this
     38   </assertion>
     39   <assertion id="7" tag="ref:XSH6:32848:32849">
     40   When it returns from main(), the effect shall be as if there was an implicit
     41   call to exit() using the return value of main() as the exit status.
     42   </assertion>
     43   <assertion id="8" tag="ref:XSH6:32850:32852">
     44   The signal state of the new thread will be initialized as so:
     45 
     46   - The signal mask shall be inherited from the created thread
     47   - The set of signals pending for the new thread shall be empty.
     48   </assertion>
     49   <assertion id="9" tag="ref:XSH6:32853:32853">
     50   The floating point environment shall be inherited from the created thread.
     51   </assertion>
     52   <assertion id="10" tag="ref:XSH6:32854:32855">
     53   If pthread_create() fails, no new thread is created and the contents of the
     54   location referenced by 'thread' is undefined.
     55   </assertion>
     56   <assertion id="11" tag="ref:XSH6:32856:32857 pt:TCT">
     57   if _POSIX_THREAD_CPUTIME is defined, the new thread shall have a CPU-time
     58   clock accessible, and the initial value of this clock shall be set to 0.
     59   </assertion>
     60   <assertion id="12" tag="ref:XSH6:32859:32859">
     61   If success, pthread_create() returns zero.
     62   </assertion>
     63   <assertion id="13" tag="ref:XSH6:32859:32860">
     64   If pthread_create() fails, an error number is returned:
     65 
     66   - [EAGAIN]	The system lacked the resources to create another thread,
     67                	or the system-imposed limit on the total number of threads
     68 		in a process {PTHREAD_THREADS_MAX} would be exceeded.
     69   - [EINVAL]	The value specified by 'attr' is invalid.
     70   - [EPERM]	The caller does not have the appropriate permission to set
     71 		the required scheduling parameters or scheduling policy.
     72   </assertion>
     73   <assertion id="14" tag="ref:XSH6TC2:33694:33694">
     74   [EINTR] must not be returned.
     75   </assertion>
     76   <assertion id="15" tag="ref:XSH6TC2:33676:33676 pt:XSI">
     77   If the current thread uses an alternate stack, the new thread does not inherit this stack.
     78   </assertion>
     79 </assertions>
     80