Worker thread is now operational
This commit is contained in:
@@ -23,19 +23,11 @@ public:
|
||||
virtual void Tick(float) override;
|
||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
|
||||
|
||||
// Thread start and shutdown.
|
||||
void LaunchThread();
|
||||
// Thread shutdown and cleanup. Called by Blueprint thread.
|
||||
void WaitForThread();
|
||||
|
||||
// Methods of FRunnable, for the thread to use.
|
||||
virtual bool Init() override;
|
||||
// Method of FRunnable, called by the Luprex thread.
|
||||
virtual uint32 Run() override;
|
||||
virtual void Stop() override;
|
||||
|
||||
// Return true if luprex was successfully initialized.
|
||||
inline bool luprex_initialized() {
|
||||
return Luprex.play_initialize != nullptr;
|
||||
}
|
||||
|
||||
// Set the entire contents of the console output box.
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
@@ -45,14 +37,32 @@ public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ConsoleSendInput(const FString& text);
|
||||
|
||||
void HandleConsoleOutput();
|
||||
// Transfer console output from the Luprex engine to unreal.
|
||||
void HandleLuprexConsoleOutput();
|
||||
|
||||
// This stores the entire text currently visible in the console.
|
||||
engineutil::ConsoleOutput ConsoleOutput;
|
||||
|
||||
// The worker thread is responsible for networking and event_update
|
||||
FRunnableThread* Thread;
|
||||
// The worker thread.
|
||||
FRunnableThread *Thread;
|
||||
|
||||
// Used to tell the worker thread to stop.
|
||||
bool ThreadStopRequested;
|
||||
|
||||
engineutil::ConsoleOutput ConsoleOutput;
|
||||
// This event is used to wake up the Luprex thread. Normally,
|
||||
// this means we want the worker to do one processing step. But
|
||||
// if ThreadStopRequested is true, it means we want the thread
|
||||
// to exit.
|
||||
FEvent* ThreadEvent;
|
||||
|
||||
// This critical section guards the use of the EngineWrapper.
|
||||
FCriticalSection LuprexMutex;
|
||||
|
||||
// The Luprex wrapper and engine. You must claim the LuprexMutex
|
||||
// before touching any of these variables.
|
||||
static EngineWrapper Luprex;
|
||||
float EngineSeconds;
|
||||
|
||||
// When do we next trigger the thread event (relative to EngineSeconds).
|
||||
float NextThreadTrigger;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user