// Copyright (c) Wojciech Figat. All rights reserved.
#pragma once
#if PLATFORM_WEB
#include "../Base/ThreadBase.h"
///
/// Thread object for Web platform.
///
class FLAXENGINE_API WebThread : public ThreadBase
{
public:
///
/// Initializes a new instance of the class.
///
/// The runnable.
/// The thread name.
/// The thread priority.
WebThread(IRunnable* runnable, const String& name, ThreadPriority priority)
: ThreadBase(runnable, name, priority)
{
}
public:
///
/// Factory method to create a thread with the specified stack size and thread priority
///
/// The runnable object to execute
/// Name of the thread
/// Tells the thread whether it needs to adjust its priority or not. Defaults to normal priority
/// The size of the stack to create. 0 means use the current thread's stack size
/// Pointer to the new thread or null if cannot create it
static WebThread* Create(IRunnable* runnable, const String& name, ThreadPriority priority = ThreadPriority::Normal, uint32 stackSize = 0)
{
return New(runnable, name, priority);
}
public:
// [ThreadBase]
void Join() override
{
// TOOD: impl this
}
protected:
// [ThreadBase]
void ClearHandleInternal() override
{
// TOOD: impl this
}
void SetPriorityInternal(ThreadPriority priority) override
{
// TOOD: impl this
}
void KillInternal(bool waitForJoin) override
{
// TOOD: impl this
}
};
#endif