分类: C/C++
2006-10-05 09:55:50
#include #include #include void *thread(void *vargp) { printf("Helo,world!\n"); exit(0); } int main() { pthread_t tid; pthread_create(&tid,NULL,thread,NULL); pthread_join(tid,NULL); printf("Thread is over!\n"); exit(0); } |
#include #include #include void *thread(void *vargp) { void *pthread_return; pthread_t id; id = pthread_self(); printf("The thread's ID is: %d.\n",id); pthread_exit(pthread_return); printf("Helo,world!\n"); } int main() { pthread_t tid; pthread_create(&tid,NULL,thread,NULL); pthread_join(tid,NULL); printf("Thread is over!\n"); exit(0); } |