add thread to handle read/write data.