Skip to content

Commit

Permalink
Add fetch(::Task) (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored and martinholters committed May 28, 2018
1 parent 6a97476 commit 0f612e1
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 @@ -297,6 +297,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 @@ -618,6 +620,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 @@ -1854,6 +1854,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 @@ -1702,6 +1702,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 0f612e1

Please sign in to comment.