c++ - read access from multiple threads -
c++ - read access from multiple threads -
read access (without using mutexes or atomics) multiple threads safe when there no write access @ same time. const variables can read multiple threads: const int x = 10;
can safe read variable without const qualifier multiple threads when i'm sure there not write access ? know not practise wonder if safe. pointers ? when need using pointer read-only access multiple threads should declared way, right ? :
const int * const p = &x;
of course of study can read non-const variable multiple threads long sure there no write operation ongoing.
const int * const p = &x;
the above statement means preventing both value , pointer beingness modified. if want protect value itself, can use
const int * p = &x;
c++ multithreading
Comments
Post a Comment