if you return from the function you'll never call amount_cond.notify_one();