|
|
|
|
|
by BudVVeezer
4766 days ago
|
|
It could rely on another variable for computation, and that other variable could be accessed outside of the function. Eg) class c {
int m1;
public:
void set_m1( int i ) { m1 = i; }
int calc( int i ) const { return m1 * 10; }
}; calc is properly const, but it's not threadsafe. |
|
Threadsafety(in this context) means that any sequence of calls of const-functions from any number of threads will have the same result. In your case there is a single const function, and you may call calc(0) from several threads and it always will return the same value. So it is pretty threadsafe.