使用共享锁来标记环形缓冲区是否正在被使用

This commit is contained in:
guo_peixu
2022-06-17 18:14:24 +08:00
parent 0ce7424fa1
commit 93c07a240b
4 changed files with 56 additions and 87 deletions

View File

@@ -1,5 +1,7 @@
#ifndef _MESA_SHM_RING_QUEUE_H_
#define _MESA_SHM_RING_QUEUE_H_
#include <pthread.h>
#define MESA_SHM_RING_QUEUE_NUM 128
#define MESA_SHM_RING_QUEUE_BLOCK_NUM 8192
#define MESA_SHM_RING_QUEUE_BLOCK_BUFLEN 4096
@@ -27,7 +29,7 @@ struct MESA_shm_overview{
int shmkey;
int shmid;
int idx;
volatile char status;
pthread_mutex_t mutex;
};
struct MESA_shm_queue_head{