Adds a new_with_delay constructor to PollWatcher#34
Conversation
|
I'm wary of extending the polling watcher API for a specific purpose. I would however accept a pull request that modified PollWatcher's default constructor with a researched change. We'd need answers to these questions:
Then taking into account these, hardcode a reasonable value in. That would then let every user on every platform take advantage of the fix by default. |
It happens on both platforms that I've tested it on (OSX and Windows). I think the reason that it shows up is that I'm only watching a single file, so the program doesn't spend much time in the FS syscalls.
Probably On my laptop (OSX): I'll test my Windows and Linux machines when I get home and see if they show similar behavior.
Not sure if we need to worry about this.
This is how things work right now. I made it so that the default constructor uses a default-value of |
Indeed, sorry I must have missed this. |
With these times, probably not. I would start being worried if the delay would be a human-noticeable one like, say, 200ms. 10 or 20ms seems like a good choice, though. |
|
Yeah, I think 10ms would be good. I'll make this change right now. |
|
@passcod Is there anything else that you want to cover, or is this mergeable? |
|
Yes, sorry for the delay. The naming style throughout the stdlib would prefer |
|
@blaenk Do you want to have a quick look over this PR to see if I've missed anything? |
85fea99 to
c18ac61
Compare
Adds a ::with_delay() constructor to PollWatcher
Currently, PollWatcher eats 100% of CPU on one of my cores because it is sitting in a tight loop. This commit includes an option to let the thread sleep once-per-iteration.