How do I make a function thread safe in C++?

Viewed 25201

Let's say I have a thread pool that has 5 child threads. And they are calling a function called "functionA()" How do I make the function to be thread safe?

Also if those 5 threads are called at the same time then are they executed concurrently? or do they wait until a thread that currently works in the function to be finished ?

Thanks in advance..

5 Answers
Related