[![This is what I want to make.][1]][1]


  [1]: https://i.sstatic.net/mxNEy.png

I want to structure my program as shown in the image, but I don't know how to get two game loops happening simultaneously.

The game loop would be a normal game loop and the game would only interact with the handlers.

The second loop is the engine, which i want to be processing everything from the system in the background while my game be running.

-- I figured that if I have two game loops--the normal game loop and the engine processing everything from the system in the background--that my games would run more smoothly.