veyron/runtimes/google/lib/follow: Fix initialization race in the follow watcher.
Sometimes, a watcher would not detect modifications to the file immediately
after the watcher was created.
This caused a race condition in Read:
1) Routine #1 creates a reader, which in turn creates a watcher.
2) Routine #1 calls reader.Read(). The Read doesn't see enough bytes, so
Routine #1 awaits an event from watcher.
3) Routine #2 writes to the file.
4) The watcher's watch routine is initialized. However, it missed the write,
and does not send an event.
As a result, Read hangs.
The watcher now waits until the watch routine is initialized before it returns.
Change-Id: Idd03b7d6a7cf7560315a8a6661c60f55dd7a06a1
5 files changed