3 ms·
You definitely need a mutex here (or use atomics), otherwise you have a race condition
by spacechild1 3y ago
You definitely need a mutex here (or use atomics), otherwise you have a race condition
- gpderetta 3y agoWhere exactly? Can you point me to the data race? Consider that the thread constructor call happens-before the thread start and the thread termination happens-before the join call returns.
- spacechild1 3y agoAh sorry, I missed that you only spawn a single thread. Mea culpa!