Read and write in separate threads