POSIX□□□□□□□pthread 叮口pthread.h 叮叮叮□叮Linux□pthread□□□□□□□□cloneQDDDDDexamplel.cLinux□C 叮叮口2007-08-2410:07:56Linux□□□□□□□□□Linux□□□□□□□□□□□□□□□libpthread.aOU 叮叮clone 血Linux□□□□□□□□□□□□□□□□□forkDDDclone 叮叮叮□叮叮叮叮皿叮叮□□□□□□□□□□□□□□□□□□□□□□/*example.c*/#include
#includevoidthread(void){inti;for(i=0;i<3;i++)printf("Thisisapthread.n");}intmain(void){pthread_tid;inti,ret;ret 二pthread_create(&id,NULL,(void*)thread,NULL);if(ret!=0){printf("Createpthreaderror!n");exit(1);}for(i=0;i<3;i++)printf("Thisisthemainprocess.n");pthread_join(id,NULL);return(0);}□□□□□□□□gccexample1.c-lpthread-oexample1example1DDDDDDDDDQThisisthemainprocess.□□pthread_join□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□apthread_create□□□□Thisisapthread.Thisisthemainprocess.Thisisthemainprocess.Thisisapthread.Thisisapthread.□□□□□□□□□□□□□□□aThisisapthread.Thisisthemainprocess.Thisisapthread.Thisisthemainprocess.Thisisapthread.Thisisthemainprocess.□□□□□□□□□□□□□□□□□□CPU□□□□□□□□□□□□□□□□□□□□□□□□pthread_create□pthread_joinU 叮□□□□pthread_t□□□□□pthread_t□□□□/usr/include/bits/pthreadtypes.h□□□□typedefunsignedlongintpthread_t;externintpthread_create__P((pthread_t*__thread,__constpthread_attr_t*__attr,void*(*__start_routine)(void*),void*—arg));□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□thread□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□0 叮叮0 叮叮叮叮叮叮叮叮叮叮EAGAIN□EINVALU□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□a□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□aexternintpthre...