Producer/Consumer implementation with thread termination after producer finished production