Concurrent programming in C++
I have problem which is more methodical, than syntactical this time. I have to make two concurrent functions. This will be something with serial communication. The task is the following:
A function is running. It has to send a serial command, and WAIT for the answer. And when the answer comes, it has to process the incoming message.
So my task is now to let Events occur while in an another function. Is there a command or anything which makes able a routine of an event run BEFORE an another routine has finished?
In my task I use an infinite loop, which checks a flag. The flag is set in an another routine. Now my problem is that the first routine HAS to finish before the other routine would run.
How can I solve this?