Fixed precompilation hang due to timer
Summary:
Whilst trying to develop my own package that uses Tk, I found I was unable to precompile it. Precompilation was hanging. Following Julia's developer documentation for support, I found that Tk.jl was responsible for the hang. This pull request is my fix for it. I have tested this fix on my demo package.
Problem:
Tk.jl causes a precompile hang when being used in another package that is being precompiled. For example, I created a package (TkPrecompileTest) with this as the source file:
module TkPrecompileTest
using Tk
end
This problem occurred when precompiling the package:
(@v1.11) pkg> activate .
Activating project at `~/[...]/TkPrecompileTest.jl`
(TkPrecompileTest) pkg> precompile
Precompiling project...
Progress [> ] 0/1
◓ TkPrecompileTest Waiting for background task / IO / time
the precompilation hanged - it would be stuck here.
Solution:
See the changed files for the fix. The fix prevented the timeout Timer from being created during package precompilation.
after the fix this is the result when precompiling the package:
(@v1.11) pkg> activate .
Activating project at `~/[...]/TkPrecompileTest.jl`
(TkPrecompileTest) pkg> dev ~/.julia/dev/Tk/
Resolving package versions...
Updating `~/[...]/TkPrecompileTest.jl/Project.toml`
[4225ea8a] ~ Tk v0.7.0 ⇒ v0.7.0 `~/.julia/dev/Tk`
Updating `~/[...]/TkPrecompileTest.jl/Manifest.toml`
[4225ea8a] ~ Tk v0.7.0 ⇒ v0.7.0 `~/.julia/dev/Tk`
(TkPrecompileTest) pkg> precompile
Precompiling project...
2 dependencies successfully precompiled in 4 seconds. 69 already precompiled.
All tests in Tk still passed after the fix. The simple example in my test package that uses Tk works perfectly after the fix.