C++ : I have a vector<bool> , no thread will ever write false to any of the indices . Should I still use a lock ? I don't think it will cause a race condition as all threads are writing the same value .
The functions being accessed by multiple threads looks like :
void setVal(int index)
{
if (boolvec[index] == false)
boolvec[index] = true;
}