Implement Oliver's code review changes.

Mostly code polishing except for two functional changes:
 -- SampleBuffer::initialize() cannot terminate calling thread
 -- write thread only sleeps when there isn't a full buffer that needs
    to be written