📄 me_ipc.h
字号:
/*******************************ipc.h**********************************************/#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>#include <sys/sem.h>#include <sys/msg.h>#define BUFSZ 256/** the functions to get the shared memary and the semaphore*/int get_ipc_id(char *proc_file,key_t key);char *set_shm(key_t shm_key,int shm_num,int shm_flag);int set_sem(key_t sem_key,int sem_val,int sem_flag);int operationP(int sem_id);int operationV(int sem_id);/** semaphore control union*/typedef union semuns{ int val;}Sem_uns;typedef struct msgbuf{ long mtype; char *mtext;} Msg_buf;/*** the variables needed by the producers and the consumers*/key_t buff_key;/*material's key*/int i;int buff_num;int *buff_ptr;int buff_flag;key_t full_key;key_t empty_key;key_t pro_ex_key;key_t cons_ex_key;int full_value;int empty_value;int pro_ex_value;int cons_ex_value;int full_sem;int empty_sem;int pro_ex_sem;int cons_ex_sem;int sem_flag;/*********************ipc.h end******************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -