All challenges
Code AnalysisIntermediate 60s

Self-deadlock from locking a non-recursive mutex twice

What happens when this program runs?
Starter code
#include <mutex>
std::mutex m;

void a() { std::lock_guard<std::mutex> g(m); b(); }
void b() { std::lock_guard<std::mutex> g(m); }

int main() { a(); }

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.

Play this in a 3-minute battle