Skip to content

Commit

Permalink
Add fetch(::Task)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed May 21, 2018
1 parent c5527e9 commit f51df63
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `squeeze` with `dims` as keyword argument ([#26660]).

* `fetch` for `Task`s ([#25940]).

* `Compat.qr` takes `pivot` as a `Val` _instance_ and keyword argument `full` ([#22475], [#24279]).

* `Compat.rmul!` provides a subset of the functionality of `LinearAlgebra.rmul!` for
Expand Down Expand Up @@ -623,6 +625,7 @@ includes this fix. Find the minimum version from there.
[#25873]: https://github.com/JuliaLang/julia/issues/25873
[#25896]: https://github.com/JuliaLang/julia/issues/25896
[#25935]: https://github.com/JuliaLang/julia/issues/25935
[#25940]: https://github.com/JuliaLang/julia/issues/25940
[#25959]: https://github.com/JuliaLang/julia/issues/25959
[#25989]: https://github.com/JuliaLang/julia/issues/25989
[#25990]: https://github.com/JuliaLang/julia/issues/25990
Expand Down
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,12 @@ elseif VERSION >= v"0.7.0-DEV.3665" # mul1! -> rmul!
using LinearAlgebra: rmul!
end

@static if VERSION < v"0.7.0-DEV.3936"
Base.fetch(t::Task) = wait(t)
else
import Base: fetch
end

# https://github.com/JuliaLang/julia/pull/27077
@static if VERSION < v"0.7.0-DEV.5087"
export isletter
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,13 @@ let A = [1 2; 3 4]
@test Compat.rmul!(Diagonal(A), Diagonal([2, 1])) == Diagonal([8, 120])
end

# 0.7.0-DEV.3936
@test let ct = current_task(), t = @task true
schedule(ct)
yieldto(t)
fetch(t)
end

# 0.7.0-DEV.5087
@test isletter('a')
@test isletter('β')
Expand Down

0 comments on commit f51df63

Please sign in to comment.