Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileWatching: cleanup timers on return #36301

Merged
merged 1 commit into from
Jun 18, 2020
Merged

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jun 16, 2020

Following discussion and my own advice at #36217, this avoids a minor temporary resource leak when using the timeout parameter. Can't really be tested as there's no visible side effects to this.

Following my own advice at #36217. Avoids a minor temporary resource leak.
@vtjnash vtjnash requested review from tkf and staticfloat June 16, 2020 03:01
Copy link
Member

@tkf tkf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looking at the diff, but yeah, using Timer is a nice solution for this 👍

@@ -649,10 +649,13 @@ giving the result of the polling.
function poll_fd(s::Union{RawFD, Sys.iswindows() ? WindowsRawSocket : Union{}}, timeout_s::Real=-1; readable=false, writable=false)
wt = Condition()
fdw = _FDWatcher(s, readable, writable)
local timer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, but why not timer = nothing and later timer === nothing || close(timer)? Is it some kind of optimization or just a coding style?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, those would be essentially same. So just equivalent variations based on how I started writing it.

@vtjnash vtjnash merged commit e96728c into master Jun 18, 2020
@vtjnash vtjnash deleted the jn/filewatching-cleanup-timer branch June 18, 2020 18:23
@vtjnash
Copy link
Member Author

vtjnash commented Jun 19, 2020

There's perhaps a chance this broke something (https://build.julialang.org/#/builders/79/builds/863/steps/5/logs/stdio), though I don't see how, but let's keep an eye on that.

simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Jun 28, 2020
Following my own advice at JuliaLang#36217. Avoids a minor temporary resource leak.
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 11, 2020
Following my own advice at JuliaLang#36217. Avoids a minor temporary resource leak.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants