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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -