I want to create two threads which will be calling even and odd functions where even function should print even number and odd function should print odd number.
Can it be possible with the help of condition variable?
please explain it with the code itself in both the cases i.e. two separate function and with the help of condition variable.
I tried to run the mentioned code above but I get lots of compilation issues. It could be because of different compiler. Could you please explain what all lines are about? If possible Can I get a code for unix environment? Actually I am trying to understand the multithreading in C++ as getting lots of questions in interview.