fix a thread-safety bug and add tox tests

@xiaogaozi  @psjay @acmerfight  review 一下，解决之前的第92行put_nowait时出现FULL