Add basic WebThread impl
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#if PLATFORM_WEB
|
||||
|
||||
#include "WebPlatform.h"
|
||||
#include "WebThread.h"
|
||||
#include "WebFileSystem.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Types/String.h"
|
||||
@@ -50,6 +51,28 @@ DialogResult MessageBox::Show(Window* parent, const StringView& text, const Stri
|
||||
return DialogResult::None;
|
||||
}
|
||||
|
||||
WebThread* WebThread::Create(IRunnable* runnable, const String& name, ThreadPriority priority, uint32 stackSize)
|
||||
{
|
||||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
if (stackSize != 0)
|
||||
pthread_attr_setstacksize(&attr, stackSize);
|
||||
auto thread = New<WebThread>(runnable, name, priority);
|
||||
const int result = pthread_create(&thread->_thread, &attr, ThreadProc, thread);
|
||||
if (result != 0)
|
||||
{
|
||||
LOG(Warning, "Failed to spawn a thread. Result code: {0}", result);
|
||||
Delete(thread);
|
||||
return nullptr;
|
||||
}
|
||||
return thread;
|
||||
#else
|
||||
LOG(Fatal, "Threading is not supported.");
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebFileSystem::GetSpecialFolderPath(const SpecialFolder type, String& result)
|
||||
{
|
||||
result = TEXT("/");
|
||||
|
||||
Reference in New Issue
Block a user