长风破浪会有时,直挂云帆济沧海

Dream Word

博客园 首页 新随笔 联系 订阅 管理

2018年5月13日 #

摘要: 举个栗子 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <unistd.h> 4 #include <sys/types.h> 5 #include <pthread.h> 6 #include <errno.h> 7 #include 阅读全文
posted @ 2018-05-13 20:50 长风II 阅读(268) 评论(0) 推荐(0) 编辑

摘要: 信号量API #include <semaphore.h> 2 //等待互斥量(原子操作) 3 int sem_wait(sem_t *serm); 4 //通知互斥量加一 5 int sem_post(sem_t *sem); 基于信号量与互斥锁实现的生产者和消费者 1 #include <std 阅读全文
posted @ 2018-05-13 20:46 长风II 阅读(257) 评论(0) 推荐(0) 编辑