Initialize the thread list mutex

This commit is contained in:
Cameron Gutman 2014-04-06 20:33:48 -04:00 committed by Michelle Bergeron
parent d5037dff82
commit cdf07e6905
4 changed files with 26 additions and 0 deletions

View File

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

View File

@ -3,6 +3,7 @@
#include "Limelight.h"
#include "Platform.h"
#include "PlatformSockets.h"
#include "PlatformThreads.h"
#include "Video.h"
char* allocateConfigDataForStreamConfig(PSTREAM_CONFIGURATION streamConfig);

View File

@ -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
}

View File

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