Can you just use a mutex here?