Code AnalysisIntermediate 60s
Detached thread using this
What is the hazard?
Starter code
struct Worker {
void start() {
std::thread([this]{ doWork(); }).detach();
}
void doWork();
~Worker(){ /* object destroyed while thread may run */ }
};Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.