Use channel as semaphore to avoid blocking in go-thread.