Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Connection.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Limelight-internal.h"

#include <stdatomic.h>

static int stage = STAGE_NONE;
static ConnListenerConnectionTerminated originalTerminationCallback;
static bool alreadyTerminated;
Expand All @@ -17,7 +19,7 @@ CONNECTION_LISTENER_CALLBACKS ListenerCallbacks;
DECODER_RENDERER_CALLBACKS VideoCallbacks;
AUDIO_RENDERER_CALLBACKS AudioCallbacks;
int NegotiatedVideoFormat;
volatile bool ConnectionInterrupted;
volatile atomic_bool ConnectionInterrupted = ATOMIC_VAR_INIT(false);
bool HighQualitySurroundSupported;
bool HighQualitySurroundEnabled;
OPUS_MULTISTREAM_CONFIGURATION NormalQualityOpusConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/Limelight-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern CONNECTION_LISTENER_CALLBACKS ListenerCallbacks;
extern DECODER_RENDERER_CALLBACKS VideoCallbacks;
extern AUDIO_RENDERER_CALLBACKS AudioCallbacks;
extern int NegotiatedVideoFormat;
extern volatile bool ConnectionInterrupted;
extern volatile atomic_bool ConnectionInterrupted;
extern bool HighQualitySurroundSupported;
extern bool HighQualitySurroundEnabled;
extern OPUS_MULTISTREAM_CONFIGURATION NormalQualityOpusConfig;
Expand Down
6 changes: 3 additions & 3 deletions src/LinkedBlockingQueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int LbqOfferQueueItem(PLINKED_BLOCKING_QUEUE queueHead, void* data, PLINKED_BLOC
queueHead->tail = entry;
}

queueHead->currentSize++;
atomic_fetch_add(&queueHead->currentSize, 1);
queueHead->lifetimeSize++;

PltUnlockMutex(&queueHead->mutex);
Expand Down Expand Up @@ -180,7 +180,7 @@ int LbqPollQueueElement(PLINKED_BLOCKING_QUEUE queueHead, void** data) {

entry = queueHead->head;
queueHead->head = entry->flink;
queueHead->currentSize--;
atomic_fetch_add(&queueHead->currentSize, -1);
if (queueHead->head == NULL) {
LC_ASSERT(queueHead->currentSize == 0);
queueHead->tail = NULL;
Expand Down Expand Up @@ -231,7 +231,7 @@ int LbqWaitForQueueElement(PLINKED_BLOCKING_QUEUE queueHead, void** data) {

entry = queueHead->head;
queueHead->head = entry->flink;
queueHead->currentSize--;
atomic_fetch_add(&queueHead->currentSize, -1);
if (queueHead->head == NULL) {
LC_ASSERT(queueHead->currentSize == 0);
queueHead->tail = NULL;
Expand Down
4 changes: 3 additions & 1 deletion src/LinkedBlockingQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "Platform.h"
#include "PlatformThreads.h"

#include <stdatomic.h>

#define LBQ_SUCCESS 0
#define LBQ_INTERRUPTED 1
#define LBQ_BOUND_EXCEEDED 2
Expand All @@ -21,7 +23,7 @@ typedef struct _LINKED_BLOCKING_QUEUE {
PLINKED_BLOCKING_QUEUE_ENTRY head;
PLINKED_BLOCKING_QUEUE_ENTRY tail;
int sizeBound;
int currentSize;
atomic_int currentSize;
int lifetimeSize;
bool shutdown;
bool draining;
Expand Down