线程退出

#include "unistd.h"
 
{
    for(;;)
    {
 
        fflush(stdout);
        sleep(1);
    }
 
{
    pthread_t id;
 
    sleep(5);
    pthread_cancel(id);
 
    sleep(5);
    pthread_exit(NULL);
 
    return 0;
}

你可能感兴趣的:(线程)