Yes, I feel the same when I read this part of the book. "inconsistentRead looks good"
But in the following paragraphs, I will explain the potential error that such synchronization / asynchrony functions can use when used (so this also could not get through).
As a result, the following was used in the sample:
In event loop 1:
reader1 created, reason: "data.txt" is not cached yet, it will respond async in another N. event loop
some callbacks subscribe to reader readiness1. And it will be called in cycle N.
In the N: "data.txt" event loop, it reads, and this notification is cached, so callbacks with readers1 are called.
In the event loop X (but X> = 1, but X may be before or after N): (maybe a timeout or other schedule of the asynchronous route) reader2 is created for the same file "data.txt"
What happens if: X === 1: the error can be expressed in the wrong way, because the result of data.txt will try to cache twice, the first read, faster, will be defeated. But reader2 will register its callbacks before the asynchronous response is ready, so they will be called.
X> 1 and X <N: the same thing happens as X === 1
X> N: the error will be expressed as described in the book:
You create reader2 (the answer for it is already cached), onDataReady is called, because the data is cached (but you have not signed any subscriber yet), and after that yo sign the callbacks with onDataReady, but this will not be called again.
X === N: Well, this is an extreme case, and if the first part of reader2 will go the same as X === 1, but if it starts after the "data.txt" section with readiness for inconsistency, then it will happen like this same as for X> N