
On Jul 5, 2004, at 10:35 PM, Howard Hinnant wrote:
vs this:
void do_sale(rw_mutex& m) { read_lock rl(m);
long balance = get_balance(); long cost = get_total_cost();
if (balance > cost) { rl.unlock(m); write_lock wl(m); set_balance(balance - cost); wl.transfer_to_read_lock(rl); balance = get_balance(); } // ... }
Oops, that should be: vs this: void do_sale(rw_mutex& m) { read_lock rl(m); long balance = get_balance(); long cost = get_total_cost(); if (balance > cost) { rl.unlock(m); write_lock wl(m); cost = get_total_cost(); set_balance(get_balance() - cost); wl.transfer_to_read_lock(rl); balance = get_balance(); } // ... } but still looks much simpler, and smaller code size to me. -Howard