Skip to content

Commit

Permalink
rename easy.{ready => done}
Browse files Browse the repository at this point in the history
Also eliminate try/catch around `wait(easy.done)` since it can't throw.
  • Loading branch information
StefanKarpinski committed Oct 28, 2021
1 parent 2958934 commit 2af290f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Curl/Easy.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mutable struct Easy
handle :: Ptr{Cvoid}
input :: IO
ready :: Threads.Event
done :: Threads.Event
seeker :: Union{Function,Nothing}
output :: IO
progress :: Function
Expand Down
2 changes: 1 addition & 1 deletion src/Curl/Multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function check_multi_info(multi::Multi)
easy = unsafe_pointer_to_objref(easy_p_ref[])::Easy
@assert easy_handle == easy.handle
easy.code = message.code
notify(easy.ready)
notify(easy.done)
else
@async @error("curl_multi_info_read: unknown message", message)
end
Expand Down
6 changes: 2 additions & 4 deletions src/Downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,8 @@ function request(

# do the request
add_handle(downloader.multi, easy)
try wait(easy.ready) # can this throw?
finally
remove_handle(downloader.multi, easy)
end
wait(easy.done)
remove_handle(downloader.multi, easy)

# return the response or throw an error
response = Response(get_response_info(easy)...)
Expand Down

0 comments on commit 2af290f

Please sign in to comment.