22 lines
465 B
C
22 lines
465 B
C
#ifndef _RINGBUFFER_H_
|
|
#define _RINGBUFFER_H_
|
|
|
|
#include <stdint.h>
|
|
#include <pthread.h>
|
|
|
|
|
|
#define BUFFER_SIZE 256
|
|
|
|
typedef struct {
|
|
void* buffer[BUFFER_SIZE+5];
|
|
uint32_t bufferReadIdx;
|
|
uint32_t bufferWriteIdx;
|
|
pthread_mutex_t eventMutex;
|
|
pthread_cond_t eventSignal;
|
|
} t_ringbuffer;
|
|
|
|
void ringbufferInit(t_ringbuffer *handle);
|
|
void ringbufferPut(t_ringbuffer *handle, void *f);
|
|
void *ringbufferGet(t_ringbuffer *handle);
|
|
|
|
#endif // _RINGBUFFER_H_
|