修改生产者和消费者都退出后,共享内存未删除的问题

生产者消费者注册信号处理函数,退出时检查如果没有其它进程使用共享内存,将共享内存删除
This commit is contained in:
guo_peixu
2022-06-30 15:16:08 +08:00
parent 89899d2d0a
commit 8267c9712e
6 changed files with 102 additions and 21 deletions

View File

@@ -37,16 +37,17 @@ struct MESA_shm_queue_head{
};
int MESA_shm_alloc_overview(struct MESA_shm_overview **ovw, int **consumer_status);
int MESA_shm_alloc_overview(struct MESA_shm_overview **ovw, int *ovw_id, int **consumer_status);
struct MESA_shm_queue_head *MESA_shm_get_ring_queue();
void MESA_shm_init_mutex();
void MESA_shm_init_overview();
void MESA_shm_init();
void MESA_shm_recycle_ring_queue(struct MESA_shm_queue_head *ring_queue_head);
int MESA_shm_copy_buf_to_ring_queue(char *buf, int buflen, struct MESA_shm_queue_head *head, char *log_file, int log_file_len);
int MESA_shm_ring_queue_is_empty(struct MESA_shm_queue_head *head);
int MESA_shm_ring_queue_is_full(struct MESA_shm_queue_head *head);
void MESA_shm_ring_queue_set_empty(struct MESA_shm_queue_head *head);
int MESA_shm_get_consumer_status();
void MESA_shm_unlink(struct MESA_shm_overview *ovw, int ovw_shmid);
#endif