#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <utils/Log.h>
void *thread_posix_function(void *arg) {
(void)arg;
int i;
for ( i=0; i<30; i++) {
// 控制台 打印
printf("hello thread i = %d\n",i);
// logcat 打印
ALOGD("hello thread i = %d\n",i);
sleep(1);
}
return NULL;
}
int main(void) {
pthread_t mythread;
if ( pthread_create( &mythread, NULL, thread_posix_function, NULL) ) {
ALOGD("error creating thread.");
abort();
}
if ( pthread_join ( mythread, NULL ) ) {
ALOGD("error joining thread.");
abort();
}
ALOGD("hello thread has run end exit\n");
exit(0);
}
frameworks 之线程类使用 原生和自定义的线程类
49 浏览量
2024-06-09
18:49:10
上传
评论
收藏 3KB ZIP 举报
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
哥咫匙传说
- 粉丝: 62
- 资源: 6
最新资源
- python实现基于深度学习高性能中文车牌识别(源码+数据)
- 用于MATLAB的bossdevice API
- docker配置使用,很值得学习的笔记
- Python实现基于 opencv 和 tensorflow 的车牌识别项目(源码+数据).zip
- TM1629B SOP-32封装 LED驱动控制专用电路 深圳市可芯电子有限公司.pdf
- qt-everywhere-src-5.15.0
- Vue3+Element Plus+pinia+ts实现的后台管理系统
- python爬取北、上、广租房信息(高分课程设计)
- Flutter Widget魔法:构建绚丽界面的秘诀
- 基于SSM的学生智能选课系统(源代码+数据库+文档)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)