If you are using c++ you may want to look into tasks. They allow you to run separate sets of code at the same time.
tasks