bool withdrawal(Account& acct, double amt) { // class Account { mutex m; ... } acct.m.lock(); if (acct.bal < amt) { acct.m.unlock(); return false; } acct.bal -= amt; acct.m.unlock(); return true; }