mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
use std::function in Thread_Create so we can revert back to using it
This commit is contained in:
@ -37,10 +37,8 @@ void SoftRenderer::StopRenderThread()
|
|||||||
{
|
{
|
||||||
RenderThreadRunning = false;
|
RenderThreadRunning = false;
|
||||||
Platform::Semaphore_Post(Sema_RenderStart);
|
Platform::Semaphore_Post(Sema_RenderStart);
|
||||||
// Platform::Thread_Wait(RenderThread);
|
Platform::Thread_Wait(RenderThread);
|
||||||
// Platform::Thread_Free(RenderThread);
|
Platform::Thread_Free(RenderThread);
|
||||||
RenderThread.join();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +49,7 @@ void SoftRenderer::SetupRenderThread()
|
|||||||
if (!RenderThreadRunning)
|
if (!RenderThreadRunning)
|
||||||
{
|
{
|
||||||
RenderThreadRunning = true;
|
RenderThreadRunning = true;
|
||||||
//RenderThread = Platform::Thread_Create(RenderThreadFunc);
|
RenderThread = Platform::Thread_Create(std::bind(&RenderThreadFunc, this));
|
||||||
RenderThread = std::thread(&SoftRenderer::RenderThreadFunc, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise more than one frame can be queued up at once
|
// otherwise more than one frame can be queued up at once
|
||||||
|
@ -505,8 +505,7 @@ private:
|
|||||||
// threading
|
// threading
|
||||||
|
|
||||||
bool Threaded;
|
bool Threaded;
|
||||||
// Platform::Thread* RenderThread;
|
Platform::Thread* RenderThread;
|
||||||
std::thread RenderThread;
|
|
||||||
bool RenderThreadRunning;
|
bool RenderThreadRunning;
|
||||||
bool RenderThreadRendering;
|
bool RenderThreadRendering;
|
||||||
Platform::Semaphore* Sema_RenderStart;
|
Platform::Semaphore* Sema_RenderStart;
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace Platform
|
namespace Platform
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -68,7 +70,7 @@ inline bool LocalFileExists(const char* name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Thread;
|
struct Thread;
|
||||||
Thread* Thread_Create(void (*func)());
|
Thread* Thread_Create(std::function<void()> func);
|
||||||
void Thread_Free(Thread* thread);
|
void Thread_Free(Thread* thread);
|
||||||
void Thread_Wait(Thread* thread);
|
void Thread_Wait(Thread* thread);
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ FILE* OpenLocalFile(const char* path, const char* mode)
|
|||||||
return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
|
return OpenFile(fullpath.toUtf8(), mode, mode[0] != 'w');
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread* Thread_Create(void (* func)())
|
Thread* Thread_Create(std::function<void()> func)
|
||||||
{
|
{
|
||||||
QThread* t = QThread::create(func);
|
QThread* t = QThread::create(func);
|
||||||
t->start();
|
t->start();
|
||||||
|
Reference in New Issue
Block a user