what can i use as a guarded block in main other than a loop

I know this is bad practice
What do you mean?
closed account (3qX21hU5)
guarded from what?
like i want main to just idle until it gets a go ahead from somewhere else, in my case a while loop with a bool statement, i could use a thread wait thing elsewhere but not in main.
closed account (3qX21hU5)
What type of go ahead? Poll driven (IE using a Game Loop where it will keep processing stuff even if there is no input), or a event driven system (IE Business software where it waits for a event/input till it responds).

It really all depends on what you are doing and there are different ways of doing it.
If you want to wait on a thread to finish, it would just be MyThred.join(); (assuming you're using the new C++11 std::thread)
http://en.cppreference.com/w/cpp/thread/thread
business type I guess, nothings happen til' i say it should :D

I cant use wait cos its in main but join, kay i will look that up.
Topic archived. No new replies allowed.