Fix race condition in initializing readThread