笔记
来源:互联网 发布:c语言数组定义初始化 编辑:程序博客网 时间:2024/06/03 20:29
/*****************************************************
copyright (C), 2014-2015, Lighting Studio. Co., Ltd.
File name:
Author:Jerey_Jobs Version:0.1 Date:
Description:
Funcion List:
*****************************************************/
#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;
}
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 笔记
- 深入理解ArrayList
- C语言编程练习--念数字
- 线性表删除
- webpack使用和踩过的坑
- 控制台,终端,tty,shell等概念的区别
- 笔记
- 2016年12月3日学习总结----以三维数组为例谈谈对数组名的理解
- 436. Find Right Interval (寻找最近的右区间)
- 谈谈APICloud与HTML在页面渲染方面的区别
- 用 Flask 来写个轻博客 (23) — 应用 OAuth 来实现 Facebook 第三方登录
- Summary Ranges
- C/C++基础面试-Const的全面理解(C部分)
- 二叉树的恢复和遍历
- xcode 使用