Call pthread_join for each thread created before disposing chan
Replace sleeps with wait_for_reader/wait_for_writer in tests

This fixes the race conditions occurring in the unit tests.
Merge pull request #15 from tylertreat-wf/no_blocking_pipe

Fix race conditions