Skip to content

Commit

Permalink
WIP: Added multithreaded scheduler
Browse files Browse the repository at this point in the history
Not used right now
  • Loading branch information
Xottab-DUTY committed May 1, 2018
1 parent 287b0a6 commit bc9171d
Show file tree
Hide file tree
Showing 8 changed files with 511 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/xrEngine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern void msCreate(LPCSTR name);
void CEngine::Initialize(void)
{
Engine.Sheduler.Initialize();
Engine.Scheduler.Initialize();
#ifdef DEBUG
msCreate("game");
#endif
Expand All @@ -26,5 +27,6 @@ void CEngine::Initialize(void)
void CEngine::Destroy()
{
Engine.Sheduler.Destroy();
Engine.Scheduler.Destroy();
Engine.External.Destroy();
}
1 change: 1 addition & 0 deletions src/xrEngine/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ENGINE_API CEngine
CEngineAPI External;
CEventAPI Event;
CSheduler Sheduler;
XRay::Scheduler Scheduler;

void Initialize();
void Destroy();
Expand Down
3 changes: 3 additions & 0 deletions src/xrEngine/ISheduled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ void ScheduledBase::shedule_Update(u32 dt)
shedule.dbg_update_shedule = shedule.dbg_startframe;
#endif
}

void ScheduledBaseMT::shedule_register() { Engine.Scheduler.Register(this); }
void ScheduledBaseMT::shedule_unregister() { Engine.Scheduler.Unregister(this); }
15 changes: 10 additions & 5 deletions src/xrEngine/ISheduled.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#ifndef XRENGINE_ISHEDULED_H_INCLUDED
#define XRENGINE_ISHEDULED_H_INCLUDED

#include "Engine.h"
#include "Common/Noncopyable.hpp"

Expand Down Expand Up @@ -42,9 +41,15 @@ class ENGINE_API ScheduledBase : public virtual ISheduled, Noncopyable
virtual SchedulerData& GetSchedulerData() override { return shedule; }
virtual void shedule_Update(u32 dt) override;
virtual shared_str shedule_Name() const override { return shared_str("unknown"); }

protected:
void shedule_register();
void shedule_unregister();
virtual void shedule_register();
virtual void shedule_unregister();
};

#endif // #ifndef XRENGINE_ISHEDULED_H_INCLUDED
class ENGINE_API ScheduledBaseMT : public ScheduledBase
{
protected:
void shedule_register() override;
void shedule_unregister() override;
};
1 change: 1 addition & 0 deletions src/xrEngine/Stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void CStats::Show()
if (g_pGameLevel)
g_pGameLevel->DumpStatistics(font, alertPtr);
Engine.Sheduler.DumpStatistics(font, alertPtr);
Engine.Scheduler.DumpStatistics(font, alertPtr);
g_pGamePersistent->DumpStatistics(font, alertPtr);
DumpSpatialStatistics(font, alertPtr, *g_SpatialSpace, engineTotal);
DumpSpatialStatistics(font, alertPtr, *g_SpatialSpacePhysic, engineTotal);
Expand Down
Loading

0 comments on commit bc9171d

Please sign in to comment.