Flush after printf in pass()

This fixes the problem where output isn't printed until all the tests
finish.
Fix deadlock race condition reported in issue #11

This fixes a deadlock bug where a waiting sender is woken up from a
reader but before it runs, other readers run which do not wake up
waiting senders.