Input handler thread.