some more mqtt stuff
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
#include "ringbuffer.h"
|
||||
|
||||
|
||||
void ringbufferInit(t_ringbuffer *handle) {
|
||||
void ringbufferInit(ringbuffer_t *handle) {
|
||||
handle->bufferReadIdx = 0;
|
||||
handle->bufferWriteIdx = 0;
|
||||
pthread_mutex_init(&(handle->eventMutex), NULL);
|
||||
@ -13,7 +13,7 @@ void ringbufferInit(t_ringbuffer *handle) {
|
||||
fprintf(stderr, "ringbuffer initialized\n");
|
||||
}
|
||||
|
||||
void ringbufferPut(t_ringbuffer *handle, void *f) {
|
||||
void ringbufferPut(ringbuffer_t *handle, void *f) {
|
||||
if (handle->bufferWriteIdx == (BUFFER_SIZE - 1)) {
|
||||
while (handle->bufferReadIdx == BUFFER_SIZE);
|
||||
} else {
|
||||
@ -33,7 +33,7 @@ void ringbufferPut(t_ringbuffer *handle, void *f) {
|
||||
}
|
||||
|
||||
|
||||
void *ringbufferGet(t_ringbuffer *handle) {
|
||||
void *ringbufferGet(ringbuffer_t *handle) {
|
||||
if (handle->bufferReadIdx == handle->bufferWriteIdx) {
|
||||
pthread_mutex_lock(&(handle->eventMutex));
|
||||
pthread_cond_wait(&(handle->eventSignal), &(handle->eventMutex));
|
||||
|
Reference in New Issue
Block a user