Pergunta de entrevista da empresa Adobe

How would I write a scoped mutex object? This was asked by their architect