Handle join to dead thread
Proper producer-consumer test/example

Configurable buffer size and number of producers/consumers.