Now exception safe (issue #5), and fixed producer/consumer samples