Made receiveloop function interruptible on Windows.