fix data races and turn on race detector by default.

In #309, we ended up with using ``sync.Cond``, which introduced the data race again.

In this PR, I use channel instead of ``sync.Cond`` similar to the first commit in #309. The difference is that instead of using close() to broadcast, I used the send operation.
Yes, it will always be a pointer. Is it what we want? May be I misunderstand the code. I will change it to use same approach in #350 (and hopefully it could make git to auto merge this PR.)