mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-22 22:45:39 +00:00
Fix compile failure on systems where pthread_t isn't a pointer, and possibly also systems where it isn't pointer-sized either
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct GpSystemServices_X_ThreadStartParams
|
||||
{
|
||||
@@ -52,13 +54,19 @@ void *GpSystemServices_X::CreateThread(ThreadFunc_t threadFunc, void *context)
|
||||
if (!evt)
|
||||
return nullptr;
|
||||
|
||||
pthread_t *threadPtr = static_cast<pthread_t*>(malloc(sizeof(pthread_t)));
|
||||
if (!threadPtr)
|
||||
{
|
||||
evt->Destroy();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GpSystemServices_X_ThreadStartParams startParams;
|
||||
startParams.m_threadContext = context;
|
||||
startParams.m_threadFunc = threadFunc;
|
||||
startParams.m_threadStartEvent = evt;
|
||||
|
||||
pthread_t thread = nullptr;
|
||||
if (pthread_create(&thread, nullptr, StaticStartThread, &startParams) != 0)
|
||||
if (pthread_create(threadPtr, nullptr, StaticStartThread, &startParams) != 0)
|
||||
{
|
||||
evt->Destroy();
|
||||
return nullptr;
|
||||
@@ -67,7 +75,7 @@ void *GpSystemServices_X::CreateThread(ThreadFunc_t threadFunc, void *context)
|
||||
evt->Wait();
|
||||
evt->Destroy();
|
||||
|
||||
return thread;
|
||||
return static_cast<void*>(threadPtr);
|
||||
}
|
||||
|
||||
bool GpSystemServices_X::Beep() const
|
||||
|
Reference in New Issue
Block a user