随笔分类 -  Posix多线程程序设计 读书笔记

一直对多线程编程朦胧的认识
该文被密码保护。
posted @ 2021-01-17 13:42 卷哭你 阅读(1) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "task.h" // static int I2S_Init_flag = 0; int main(int argc,char**argv) { int ch = 阅读全文
posted @ 2020-09-10 19:40 卷哭你 阅读(178) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #include <signal.h> static in 阅读全文
posted @ 2020-09-09 23:48 卷哭你 阅读(394) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> static int pthread_run = 1; static void print(cha 阅读全文
posted @ 2020-09-07 08:43 卷哭你 阅读(281) 评论(0) 推荐(0)
摘要:同步模型: #include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> //#define EXIT_SUCCESS 0 //#define EXIT_FAI 阅读全文
posted @ 2020-09-06 23:10 卷哭你 阅读(171) 评论(0) 推荐(0)
摘要:#include "common.h" /** 这种情况一般用于某个多线程调用的模块使用前的初始化,但是无法判定哪个线程先运行,从而不知道把初始化代码放在哪个线程合适的问题。 当然,我们一般的做法是把初始化函数放在main里,创建线程之前来完成,但是如果我们的程序最终不是做成可执行程序,而是编译成库 阅读全文
posted @ 2020-09-03 11:07 卷哭你 阅读(171) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-31 14:16 卷哭你 阅读(4) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-25 01:14 卷哭你 阅读(0) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-24 15:09 卷哭你 阅读(0) 评论(0) 推荐(0)
摘要:、 、 、 谓词就是判断,?? 例子:谓词:if(FD_ISSET(fd, &efds)) 不变量:音频配置参数 i2c配置参数 硬件配置参数 临界区:>2 进程和线程都会访问的串行地方 或变量(复杂构造类型的变量和短变量) 阅读全文
posted @ 2020-08-24 09:44 卷哭你 阅读(188) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-21 19:28 卷哭你 阅读(2) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-21 11:50 卷哭你 阅读(5) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-21 09:31 卷哭你 阅读(4) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2020-08-18 20:57 卷哭你 阅读(1) 评论(0) 推荐(0)
摘要:# pwd /proc/68 # cat status Name: nfsiod State: S (sleeping) Tgid: 68 Ngid: 0 Pid: 68 PPid: 2 TracerPid: 0 Uid: 0 0 0 0 Gid: 0 0 0 0 FDSize: 64 Groups 阅读全文
posted @ 2020-08-18 19:43 卷哭你 阅读(1609) 评论(0) 推荐(0)
摘要:找了半天在glibc里面 阅读全文
posted @ 2020-04-09 11:32 卷哭你 阅读(2895) 评论(0) 推荐(0)
摘要:(1) 线程系统的三个基本要素:执行环境,调度,同步。 同步: 使用互斥量来保护共享数据,使用条件变量来通信,使用条件变量来通信,其他同步机制,如信号量管道和消息队列。互斥量允许线程在访问共享数据 锁定他,以避免其他线程干扰。条件变量允许线程等待共享数据到达某个期望的状态。(队列非空或者资源可用) 阅读全文
posted @ 2020-04-06 11:53 卷哭你 阅读(297) 评论(0) 推荐(0)
摘要:使用c库操作文件 #include "stdafx.h" #include <stdio.h> #include <pthread.h> #include <assert.h> #include <windows.h> #include <string.h> static void* Functio 阅读全文
posted @ 2020-04-06 11:30 卷哭你 阅读(562) 评论(0) 推荐(0)
摘要:我们写的代码最终都要编译成为二进制程序,然后这个程序放到内存里面去。 和多进程比较一下 区别 阅读全文
posted @ 2020-04-05 22:44 卷哭你 阅读(413) 评论(0) 推荐(0)
摘要:IO就是读数据或者写数据 包含一个时间概念在里面 包含一个system概念 读数据的策略 阻塞和非阻塞时设备访问的两种基本形式。使用这两种形式,驱动程序可以灵活地支持阻塞和非阻塞的访问。select函数底层实现,里面实现用就是等待队列。 阻塞调用时指调用结果返回之前,当前线程挂起。函数只有得到结果之 阅读全文
posted @ 2020-04-05 15:44 卷哭你 阅读(2002) 评论(0) 推荐(0)