Ever watch that little network icon in the systray? Wonder how it
knows when to blink when there is network activity? I didn’t
either, but then I came across an entry from Mark that describes how it
determines when to blink. The program, represented by the network icon, polls a couple registry keys about twice per second, to determine if there is activity. As he
outlines in this post, polling ultimately hurts system performance,
since it takes cycles away from useful applications and can cause
memory page faults.
So what does Mark recommend a windows developer to do as an alternative to polling? For the registry, use the RegNotifyChangeKeyValue function. For the file system, use ReadDirectoryChangesW and/or FindFirstChangeNotification functions…