1211
来源:互联网 发布:淘宝信誉评级极好 编辑:程序博客网 时间:2024/05/18 19:40
#include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
char message[]="hello world!\n";
void * thread_function(void * arg)
{
printf("thread_function is running! argument is %s\n",(char *)arg);
sleep(3);
strcpy(message,"bye");
pthread_exit("thank for your CPU time!\n\a");
}
int main()
{
int res;
pthread_t a_thread;
void * thread_result;
res = pthread_create(&a_thread,NULL,thread_function,(void *)message);
printf("waiting for thread to finish!\n");
res = pthread_join(a_thread,&thread_result);
printf("thread joined, it returned %s\n",(char *)thread_result);
printf("message is now %s\n",message);
return 0;
}
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
char message[]="hello world!\n";
void * thread_function(void * arg)
{
printf("thread_function is running! argument is %s\n",(char *)arg);
sleep(3);
strcpy(message,"bye");
pthread_exit("thank for your CPU time!\n\a");
}
int main()
{
int res;
pthread_t a_thread;
void * thread_result;
res = pthread_create(&a_thread,NULL,thread_function,(void *)message);
printf("waiting for thread to finish!\n");
res = pthread_join(a_thread,&thread_result);
printf("thread joined, it returned %s\n",(char *)thread_result);
printf("message is now %s\n",message);
return 0;
}
0 0
- 1211
- 1211
- 1211
- 1211
- 1211塌方
- sicily 1211
- HDU 1211
- 1211 -- 统计数字
- bzoj 1211
- Lightoj 1211
- sdut 1211
- 1211 模式匹配
- hdu 1211 RSA
- pz之1211
- hdoj 1211-RSA
- hdu 1211 RSA 解密
- hdu 1211 RSA
- HDU 1211 求逆元
- Activity的生命周期小结
- datagridview 控件常用属性——机房合作
- 调用相机和相册
- Activity的启动模式小结
- 绑定服务的注意事项小结
- 1211
- 树莓派3b 使用putty无法继续ssh登录
- 控制时间闪屏二种方法
- leetCode 数值
- 由两个曲面确定的交线的切向量求解
- 3378 数据结构实验之查找六:顺序查找
- 设置无主题样式2中方式
- Dojo1.11官方教程文档翻译(4.6)创建类
- C语言数据类型