linux进程间互斥锁和条件变量
设置进程间共享属性互斥锁和条件变量 将该互斥锁和条件变量放到共享内存中 public.h # ifndef _PUBLIC_H # define _PUBLIC_H # include <pthread.h> # include <string.h> # include <stdio.h> # include <stdlib.h> # include <unistd.h> # include <errno.h> # include <ctype.h> # include <sys/mman.h> # include <sys/stat.h> /* For mode constants */ # include <fcntl.h> /* For O_* constants */ typedef struct interaction { int id ; char name [ 8 ] ; pthread_cond_t cond ; pthread_mutex_t mutex ; } Interaction ; extern Interaction * get_interaction ( const char * filename ) ; # endif // _PUBLIC_H interaction.c #include "public.h" Interaction* get