随笔分类 - 多进程间通讯
摘要:通过信号量与共享内存实现不同进程间通讯 头文件:myshm.h #ifndef __MYSHM_H__#define __MYSHM_H__ #define KEYPATH "/etc"#define SEMPRJ 'a'#define SHMPRJ 'b'#define NAMESIZE 1024
阅读全文
摘要:多线程间通过信号量通讯 int semget(key_t key, int nsems, int semflg); int semop(int semid, struct sembuf *sops, size_t nsops); int semctl(int semid, int semnum, i
阅读全文
摘要:多进程间通过消息队列通讯简单示例 头文件:proto.h #ifndef __PROTO_H__ #define __PROTO_H__ #define KEYPATH "/etc/services" #define KEYID 'a'#define NAMESIZE 1024 struct stu
阅读全文
摘要:伪代码实现通过匿名管道播放网络视频、音乐等。 示例:player.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h>#include <fcn
阅读全文
摘要:父子进程匿名管道通讯 示例:pipe.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h> #define BUFFSIZE 1024 int
阅读全文