Skip to content
Snippets Groups Projects
Commit d8a4a251 authored by Geo Ster's avatar Geo Ster
Browse files

Move ComponentManger to a seperate thread

* Currently the interperter performance was extermely slow
due to the handling of window events from glfw blocking the execution
of new instructions. Moving the execution to a seperate thread, results
in massive performance improvements. However the current implementation
is only temporary and will be modularized in the future.
parent 45db21fd
No related branches found
No related tags found
No related merge requests found
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <common/manager.hpp>
#include <thread>
int main()
{
......@@ -25,16 +26,15 @@ int main()
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
return -1;
/* Move ComponentManger to its own thread for maximum performance. */
ComponentManager manager;
std::thread thread([&]() { while (true) { manager.tick(); } });
while (!glfwWindowShouldClose(window))
{
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
/* Update all the components (CPU, GPU, DMA) */
manager.tick();
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment