some more mqtt stuff

This commit is contained in:
2020-06-17 16:03:32 +02:00
parent 034ad78ceb
commit e1a8e7d63e
6 changed files with 179 additions and 74 deletions

View File

@ -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));