随笔分类 - linux并发应用程序开发
做产品 核心在应用 认清技术重点
摘要:static int fd; static uint64_t buffer; static void threadFunc(void) //线程函数 { int t; eventfd_t value; int ret = -1; while(1) { #if 0 t = read(fd,&buffe
阅读全文
摘要:添加环境变量: (1)找到编译链包,get xxx/bin/路径 (2)临时测试: export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- export PATH=$PATH:xxx/bin/路径 source ~/.bashrc arm-
阅读全文
摘要:#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 =
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #include <signal.h> static in
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> static int pthread_run = 1; static void print(cha
阅读全文
摘要:同步模型: #include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> //#define EXIT_SUCCESS 0 //#define EXIT_FAI
阅读全文
摘要:#include "common.h" /** 这种情况一般用于某个多线程调用的模块使用前的初始化,但是无法判定哪个线程先运行,从而不知道把初始化代码放在哪个线程合适的问题。 当然,我们一般的做法是把初始化函数放在main里,创建线程之前来完成,但是如果我们的程序最终不是做成可执行程序,而是编译成库
阅读全文
摘要:、 、 、 谓词就是判断,?? 例子:谓词:if(FD_ISSET(fd, &efds)) 不变量:音频配置参数 i2c配置参数 硬件配置参数 临界区:>2 进程和线程都会访问的串行地方 或变量(复杂构造类型的变量和短变量)
阅读全文
摘要:# 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
阅读全文
摘要:echo 1 > /proc/sys/kernel/sysrq echo b > /proc/sysrq-trigger linux重启命令 (需要两条) du -sh xxx 查看文件夹包含里面大小 (看做整体 全集) ls -lh xxx 查看文件夹内部组件大小 (部分 子集)
阅读全文
摘要:(1) 线程系统的三个基本要素:执行环境,调度,同步。 同步: 使用互斥量来保护共享数据,使用条件变量来通信,使用条件变量来通信,其他同步机制,如信号量管道和消息队列。互斥量允许线程在访问共享数据 锁定他,以避免其他线程干扰。条件变量允许线程等待共享数据到达某个期望的状态。(队列非空或者资源可用)
阅读全文

浙公网安备 33010602011771号