消费者通过注册信号处理函数,在退出时向共享内存中添加状态标记,生产者通过此标记确定消费者是否在运行。删除信号量相关代码
This commit is contained in:
@@ -18,22 +18,8 @@
|
||||
|
||||
#define MESA_SEM_KEY 35719
|
||||
|
||||
|
||||
struct MESA_shm_overview *MESA_shm_alloc_overview();
|
||||
struct MESA_shm_queue_head *MESA_shm_get_ring_queue();
|
||||
void MESA_shm_init_mutex();
|
||||
void MESA_shm_init_overview();
|
||||
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_alloc_sem();
|
||||
int MESA_shm_consumer_is_running();
|
||||
|
||||
|
||||
|
||||
|
||||
#define MESA_CONSUMER_RUNNING 1
|
||||
#define MESA_CONSUMER_NOT_RUNNING 0
|
||||
|
||||
struct MESA_shm_overview{
|
||||
int shmkey;
|
||||
@@ -51,6 +37,18 @@ struct MESA_shm_queue_head{
|
||||
int ovw_idx;
|
||||
};
|
||||
|
||||
|
||||
int MESA_shm_alloc_overview(struct MESA_shm_overview **ovw, 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_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();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user