i want to write a program,i have : class with two function in that
i want these two function work concurrency,
any body can help me?
i need one simple example to understand
I literally typed 'thread' into the search bar and was taken immediately to this page:

There is an example here that looks like exactly what you're looking for.
FWIW.... a word of warning:

Multithreading in C++ is very difficult to do properly. Specifically shared access to variables in multiple threads need to be protected to avoid race conditions.

While it is certainly easy to slap together a program that has 2 functions running concurrently, getting those 2 functions to behave how you expect them to can be very tricky.

So before you start down this road... ask yourself if it's really necessary. Do you really need these functions to be parallel? Or can they run serially?
thanks booradley
in this program ,there isn't class.As i said before i have one class with two function in that.
in fact ,i want these two function would have been two loop in that i=0,1,2,...,10 one function get a number and another do mathematics on the same number but i can't write this yet because they run chaotic and I am amaze
Topic archived. No new replies allowed.