#include#include #include void *process(void *data){ while (1){ printf("xxx---------->I'm is Son thread...n"); sleep(1); } pthread_exit(nullptr); } int main(){ pthread_t pid; printf("xxx---------->%s(), line = %dn",__FUNCTION__,__LINE__); pthread_create(&pid, nullptr, process, nullptr); //1.同步: 等待线程退出,释放资源 //pthread_join(pid,nullptr); //2.异步:主进程和线程分离,各自释放资源 pthread_detach(pid); return 0; }



