Use Semaphore to avoid the internal queues grow infinitely.
Merge pull request #144 from EasonLiao/limit_queue

Use Semaphore to avoid the internal queues grow infinitely.