4.9.   145

pthread_attr_setdetachstate(&DetachedAttr,

PTHREAD_CREATE_DETACHED) ;

pthread_create(&ThreadA,NULL,taski,&N) ;

pthread_create(&ThreadB,&DetachedAttr,task2,&N) ;

cout  "   ."  endl ;

pthread_join(ThreadA,NULL) ;

return (0) ;

}

  4.2    DetachedAttr,   -
   pthread_attr_init ().    -
   pthread_attr_detachstate (),   
detachstate (""),   PTHREAD_CREATE_DETACHED
("").     ThreadB   
pthread_create ()       
 DetachedAttr.   ThreadB   pthread_join()  -
,     .

4.9.  

    ,  -  
,       .  
         
.      .  , 
   ,     :    -
     .  ,    -
        .  -
   ,     .  -
            5.  
    :       .

4.9.1.  

       :

          
(  );

        ;

          .

,    pthread_join ()  -
   ,   pthread_exit (), -
    .     -
   pthread_exit (),       
,   ,   ;   
    NULL.

 ,       
   . ,    ,  -
   .  ,    "  "