
Linux c
LION_LOPMS
这个作者很懒,什么都没留下…
展开
-
Posix共享内存
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <semaphore.h> #include <sys/mman.h> #include <string.h> #define SHM_NAME "/memmap" #define SHM_NAME_SEM "/memmap_..原创 2020-05-26 17:50:40 · 199 阅读 · 0 评论 -
有名信号量
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <semaphore.h> #include <sys/stat.h> void Testfun(sem_t* sem1) { static int num = 0; for(;;) { sem_wait(sem1); printf("this is sem1 fun num =%.原创 2020-05-25 12:19:37 · 318 阅读 · 0 评论 -
Linux进程通信无名管道PIPE,有名管道FIFO
PIPE相关代码 Talk is cheap ,show me the code! #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> //authour:liyya /*管道的读写行为 使用管道需要注意以下4种特殊情况(假设都是阻塞I/O操作,没有设置O_NONBLOCK标志): 1. 如果所有指向管道写端的文件描述符都关闭了(管道写原创 2020-05-19 09:58:38 · 192 阅读 · 0 评论