Skip to content

Instantly share code, notes, and snippets.

@bazhenovc
Created August 16, 2014 11:16
Show Gist options
  • Save bazhenovc/7cb217df9792c97edc24 to your computer and use it in GitHub Desktop.
Save bazhenovc/7cb217df9792c97edc24 to your computer and use it in GitHub Desktop.
BulletManager manager;
std::atomic<int> signalQuit;
void Thread1()
{
while (signalQuit == 0) {
manager.Fire();
}
}
void Thread2()
{
while (signalQuit == 0) {
manager.Fire();
}
}
int main()
{
std::thread t1(Thread1);
std::thread t2(Thread2);
signalQuit = 0;
bool running = true;
while (running) {
manager.Update();
if (KeyPressed(ESCAPE))
running = false;
}
signalQuit = 1;
t1.join();
t2.join();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment