add threading and some.

- Add threading.Thread as parent class to implement threading funcs.
- Move time.sleep to 'if not line' case to read all lines when multiple lines are available.