Fix for bug where the consumer thread calls join() on itself causing it to be hung forever.