Skip to content

Commit ca2a94a

Browse files
authored
Merge branch 'backports-release-1.8' into sb/env_project_file
2 parents 63b07da + c6dc6d1 commit ca2a94a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+790
-382
lines changed

base/asyncevent.jl

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,22 @@ the async condition object itself.
4545
"""
4646
function AsyncCondition(cb::Function)
4747
async = AsyncCondition()
48-
t = @task while _trywait(async)
49-
cb(async)
50-
isopen(async) || return
48+
t = @task begin
49+
unpreserve_handle(async)
50+
while _trywait(async)
51+
cb(async)
52+
isopen(async) || return
53+
end
54+
end
55+
# here we are mimicking parts of _trywait, in coordination with task `t`
56+
preserve_handle(async)
57+
@lock async.cond begin
58+
if async.set
59+
schedule(t)
60+
else
61+
_wait2(async.cond, t)
62+
end
5163
end
52-
lock(async.cond)
53-
_wait2(async.cond, t)
54-
unlock(async.cond)
5564
return async
5665
end
5766

@@ -115,6 +124,7 @@ function _trywait(t::Union{Timer, AsyncCondition})
115124
# full barrier now for AsyncCondition
116125
t isa Timer || Core.Intrinsics.atomic_fence(:acquire_release)
117126
else
127+
t.isopen || return false
118128
t.handle == C_NULL && return false
119129
iolock_begin()
120130
set = t.set
@@ -123,14 +133,12 @@ function _trywait(t::Union{Timer, AsyncCondition})
123133
lock(t.cond)
124134
try
125135
set = t.set
126-
if !set
127-
if t.handle != C_NULL
128-
iolock_end()
129-
set = wait(t.cond)
130-
unlock(t.cond)
131-
iolock_begin()
132-
lock(t.cond)
133-
end
136+
if !set && t.isopen && t.handle != C_NULL
137+
iolock_end()
138+
set = wait(t.cond)
139+
unlock(t.cond)
140+
iolock_begin()
141+
lock(t.cond)
134142
end
135143
finally
136144
unlock(t.cond)
@@ -266,19 +274,28 @@ julia> begin
266274
"""
267275
function Timer(cb::Function, timeout::Real; interval::Real=0.0)
268276
timer = Timer(timeout, interval=interval)
269-
t = @task while _trywait(timer)
270-
try
271-
cb(timer)
272-
catch err
273-
write(stderr, "Error in Timer:\n")
274-
showerror(stderr, err, catch_backtrace())
275-
return
277+
t = @task begin
278+
unpreserve_handle(timer)
279+
while _trywait(timer)
280+
try
281+
cb(timer)
282+
catch err
283+
write(stderr, "Error in Timer:\n")
284+
showerror(stderr, err, catch_backtrace())
285+
return
286+
end
287+
isopen(timer) || return
288+
end
289+
end
290+
# here we are mimicking parts of _trywait, in coordination with task `t`
291+
preserve_handle(timer)
292+
@lock timer.cond begin
293+
if timer.set
294+
schedule(t)
295+
else
296+
_wait2(timer.cond, t)
276297
end
277-
isopen(timer) || return
278298
end
279-
lock(timer.cond)
280-
_wait2(timer.cond, t)
281-
unlock(timer.cond)
282299
return timer
283300
end
284301

base/binaryplatforms.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ const libstdcxx_version_mapping = Dict{String,String}(
667667
668668
Parses a string platform triplet back into a `Platform` object.
669669
"""
670-
function Base.parse(::Type{Platform}, triplet::AbstractString; validate_strict::Bool = false)
670+
function Base.parse(::Type{Platform}, triplet::String; validate_strict::Bool = false)
671671
# Helper function to collapse dictionary of mappings down into a regex of
672672
# named capture groups joined by "|" operators
673673
c(mapping) = string("(",join(["(?<$k>$v)" for (k, v) in mapping], "|"), ")")
@@ -751,6 +751,8 @@ function Base.parse(::Type{Platform}, triplet::AbstractString; validate_strict::
751751
end
752752
throw(ArgumentError("Platform `$(triplet)` is not an officially supported platform"))
753753
end
754+
Base.parse(::Type{Platform}, triplet::AbstractString; kwargs...) =
755+
parse(Platform, convert(String, triplet)::String; kwargs...)
754756

755757
function Base.tryparse(::Type{Platform}, triplet::AbstractString)
756758
try

base/cmd.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function show(io::IO, cmd::Cmd)
130130
print(io, '`')
131131
if print_cpus
132132
print(io, ", ")
133-
show(io, collect(Int, cmd.cpus))
133+
show(io, collect(Int, something(cmd.cpus)))
134134
print(io, ")")
135135
end
136136
print_env && (print(io, ","); show(io, cmd.env))

0 commit comments

Comments
 (0)