I have a multi-threaded server thread that performs the same task. These threads are init using the Server :: * procedure.
In this procedure, there is an endless loop with some processing.
I was wondering if it is possible to use a stream safe in the same way for multiple threads? Not surprisingly, for class fields, if I want to read or write, I will use the mutex. But what about the procedure itself?
Since the function is an address, will these threads work in the same memory area?
Do I need to create a method with the same code for each thread?
Ps: I am using std :: mutex (& Server :: Task, this)
source
share