use queue to keep thread safe