|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 catch 于 2014-7-17 10:27 编辑
- #include <stdio.h>
- #include <stdlib.h>
- #include <pthread.h>
- #include <unistd.h>
- #include <string.h>
- void thread(void)
- {
- int i;
- for(i=0; i<3; i++)
- printf("This is a pthread.\n");
- }
- int main(void)
- {
- pthread_t id;
- int i,ret;
- ret=pthread_create(&id,NULL,(void *) thread,NULL);
- if(ret!=0)
- {
- printf ("Create pthread error!\n");
- exit (1);
- }
- for(i=0; i<3; i++)
- printf("This is the main process.\n");
- pthread_join(id,NULL);
- return (0);
- }
复制代码 大家说,上面的代码运行结果是什么?希望有详细图解~
|
|