Skip to content

Commit

Permalink
Merge pull request #10 from lassepe/feature/julia-1.5-compat
Browse files Browse the repository at this point in the history
Admit use of Julia 1.5
  • Loading branch information
findmyway authored Mar 18, 2021
2 parents 424c446 + a68ae2f commit 93e252a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ MacroTools = "0.5"
PNGFiles = "0.3"
ProgressMeter = "1"
ProtoBuf = "0.10"
julia = "1.6"
julia = "1.5"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
11 changes: 5 additions & 6 deletions src/datasets/datasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ end

Base.close(b::RingBuffer) = close(b.buffers) # will propergate to b.results

function RingBuffer(f!, buffer::T;sz=Threads.nthreads(), taskref=nothing) where T
function RingBuffer(f!, buffer::T; sz = Threads.nthreads(), taskref = nothing) where {T}
buffers = Channel{T}(sz)
for _ in 1:sz
put!(buffers, deepcopy(buffer))
end
results = Channel{T}(sz, spawn=true, taskref=taskref) do ch
Threads.foreach(buffers;schedule=Threads.StaticSchedule()) do x
# for x in buffers
f!(x) # in-place operation
results = Channel{T}(sz, spawn = true, taskref = taskref) do ch
Threads.@threads :static for x in buffers
f!(x)
put!(ch, x)
end
end
Expand All @@ -90,4 +89,4 @@ end

include("rl_unplugged/rl_unplugged.jl")

end
end

0 comments on commit 93e252a

Please sign in to comment.