Multiple Main() Functions

I was wondering if it would be possible to have two main functions in one program running coincidentally (at the same time). I need both the mains to execute at once and be doing different things at the same time. Would this be possible if so how?
You can only have one main function. But what you can do is have multiple threads. For that you need a thread library.

Boost comes with a portable thread library:
http://www.boost.org/doc/libs/1_46_1/doc/html/thread.html
No, but there is something called "Multithreading" which does this. basically, you make a function, and then from main you start it as a thread and it will run on its own alongside main. This is platform specific, though, and unless you have a library that takes care of different platforms for you (like boost), then you'll have to tell us what platform you're on so we can assist you.

EDIT: Ninja'd by Galik and his little dog too
Last edited on
Oh all right, appreciate the help. I have a Mac and Windows. I could use whichever platform is easier, preferably the Mac. Could you redirect me to a good tutorial for beginners on multithreading for either platform?
Thanks again.
Topic archived. No new replies allowed.