move mutex into ringbuffer
also make buffer void*
This commit is contained in:
@ -1,12 +1,15 @@
|
||||
#include <pthread.h>
|
||||
|
||||
struct ringBuffer {
|
||||
char *buffer;
|
||||
void *buffer;
|
||||
int blocks;
|
||||
size_t blockSize;
|
||||
int reader;
|
||||
int writer;
|
||||
void *reader;
|
||||
void *writer;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
void ringBufferCreate(int blocks, size_t blockSize, struct ringBuffer *out);
|
||||
void ringBufferDestroy(struct ringBuffer *buf);
|
||||
int ringBufferRead(struct ringBuffer *buf, char *out);
|
||||
void ringBufferWrite(struct ringBuffer *buf, char *in);
|
||||
int ringBufferRead(struct ringBuffer *buf, void *out);
|
||||
void ringBufferWrite(struct ringBuffer *buf, void *in);
|
||||
|
Reference in New Issue
Block a user