mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-17 08:55:48 +00:00
Initialize the thread list mutex
This commit is contained in:
parent
d5037dff82
commit
cdf07e6905
@ -80,6 +80,7 @@ void LiStopConnection(void) {
|
||||
if (stage == STAGE_PLATFORM_INIT) {
|
||||
Limelog("Cleaning up platform...");
|
||||
cleanupPlatformSockets();
|
||||
cleanupPlatformThreads();
|
||||
stage--;
|
||||
Limelog("done\n");
|
||||
}
|
||||
@ -100,6 +101,12 @@ int LiStartConnection(IP_ADDRESS host, PSTREAM_CONFIGURATION streamConfig, PCONN
|
||||
ListenerCallbacks.stageFailed(STAGE_PLATFORM_INIT, err);
|
||||
goto Cleanup;
|
||||
}
|
||||
err = initializePlatformThreads();
|
||||
if (err != 0) {
|
||||
Limelog("failed: %d\n", err);
|
||||
ListenerCallbacks.stageFailed(STAGE_PLATFORM_INIT, err);
|
||||
goto Cleanup;
|
||||
}
|
||||
stage++;
|
||||
LC_ASSERT(stage == STAGE_PLATFORM_INIT);
|
||||
ListenerCallbacks.stageComplete(STAGE_PLATFORM_INIT);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "Limelight.h"
|
||||
#include "Platform.h"
|
||||
#include "PlatformSockets.h"
|
||||
#include "PlatformThreads.h"
|
||||
#include "Video.h"
|
||||
|
||||
char* allocateConfigDataForStreamConfig(PSTREAM_CONFIGURATION streamConfig);
|
||||
|
@ -268,3 +268,18 @@ int PltWaitForEvent(PLT_EVENT *event) {
|
||||
return PLT_WAIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
int initializePlatformThreads(void) {
|
||||
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
||||
return PltCreateMutex(&thread_list_lock);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void cleanupPlatformThreads(void) {
|
||||
#if defined(LC_WINDOWS) || defined(LC_WINDOWS_PHONE)
|
||||
PltDeleteMutex(&thread_list_lock);
|
||||
#else
|
||||
#endif
|
||||
}
|
@ -42,6 +42,9 @@ CreateThread(
|
||||
);
|
||||
#endif
|
||||
|
||||
int initializePlatformThreads(void);
|
||||
void cleanupPlatformThreads(void);
|
||||
|
||||
int PltCreateMutex(PLT_MUTEX *mutex);
|
||||
void PltDeleteMutex(PLT_MUTEX *mutex);
|
||||
void PltLockMutex(PLT_MUTEX *mutex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user