Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into lh/hardcode-backlinks
Browse files Browse the repository at this point in the history
LilithHafner authored Jan 17, 2024
2 parents 650d29c + a9d274f commit 9c0eab4
Showing 4 changed files with 22 additions and 17 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@ on:
pull_request:
branches:
- master
- release-1.4
- release-*
push:
branches:
- master
- release-1.4
- release-*
tags: '*'
jobs:
test:
@@ -18,6 +18,7 @@ jobs:
matrix:
version:
- '1.3'
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia.
- 'nightly'
os:
@@ -31,22 +32,15 @@ jobs:
exclude:
- os: macOS-latest
arch: x86
- os: windows-latest
version: '1.3' # `curl_easy_setopt: 48` error on github CI
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-${{ matrix.os }}
${{ runner.os }}-
- uses: julia-actions/cache@v1
- run: julia --color=yes .ci/test_and_change_uuid.jl
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
1 change: 1 addition & 0 deletions src/Curl/Curl.jl
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ export
add_handle,
remove_handle

using Base: @lock
using LibCURL
using LibCURL: curl_off_t, libcurl
# not exported: https://github.com/JuliaWeb/LibCURL.jl/issues/87
13 changes: 13 additions & 0 deletions src/Curl/Multi.jl
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ mutable struct Multi
function Multi(grace::Integer = typemax(UInt64))
multi = new(ReentrantLock(), C_NULL, nothing, Easy[], grace)
finalizer(done!, multi)
@lock MULTIS_LOCK push!(filter!(m -> m.value isa Multi, MULTIS), WeakRef(multi))
return multi
end
end
@@ -52,6 +53,18 @@ function add_handle(multi::Multi, easy::Easy)
end
end

const MULTIS_LOCK = Base.ReentrantLock()
const MULTIS = WeakRef[]
# Close any Multis and their timers at exit that haven't been finalized by then
Base.atexit() do
while true
w = @lock MULTIS_LOCK (isempty(MULTIS) ? nothing : pop!(MULTIS))
w === nothing && break
w = w.value
w isa Multi && done!(w)
end
end

function remove_handle(multi::Multi, easy::Easy)
lock(multi.lock) do
@check curl_multi_remove_handle(multi.handle, easy.handle)
5 changes: 1 addition & 4 deletions src/Downloads.jl
Original file line number Diff line number Diff line change
@@ -467,11 +467,8 @@ end

# Precompile
let
d = Downloader(; grace=0.01)
d = Downloader()
download("file://" * @__FILE__; downloader=d)
# Ref https://github.com/JuliaLang/julia/issues/49513
# we wait for the grace task to finish
sleep(0.05)
precompile(Tuple{typeof(Downloads.download), String, String})
precompile(Tuple{typeof(Downloads.Curl.status_2xx_ok), Int64})
end

0 comments on commit 9c0eab4

Please sign in to comment.