Open 7d4b9 opened 4 years ago
This also allows one to call WriteConfig
while WatchConfig
have been called already because now the WriteConfig
can cancel and restart the watching of config file with no race conditions on file access (data corruption)
This is resolving #742
Considering the following snippets (end and begin of function
WatchConfig
)BEGIN of WatchConfig
It is obvious that
init.Done()
is called beforeeventsWG.Wait()
This mean that the inner goroutine which process the events is DANGLING and cannot be stopped and checked.
So my Question is: Why making people believe that the design is standard with kind of "standard like/agnostic construct".
Lines
initWG.Done()
andeventWG.Wait()
should be swapped to be ok but it is not possible without deadlock.So to be more aligned with good readable goroutine
WatchConfig
function.So here is what I propose to do:
This appear to be far away better as for now there is no more dangling and it is now POSSIBLE to cancel the whole watching with
cancelWatchConfig