Skip to content

Commit

Permalink
Moving results to poolresults
Browse files Browse the repository at this point in the history
  • Loading branch information
Trey Roessig committed Apr 25, 2021
1 parent 35c3c19 commit d6da10b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/ThreadPools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ThreadPools

export @tthreads, @bthreads, @qthreads, @qbthreads
export @logthreads, @logbthreads, @logqthreads, @logqbthreads
export twith, isactive, @tspawnat
export twith, poolresults, isactive, @tspawnat
export dumplog, readlog, showactivity, showstats
export tmap, bmap, qmap, qbmap
export logtmap, logbmap, logqmap, logqbmap
Expand Down
6 changes: 3 additions & 3 deletions src/logqpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ isactive(pool::LoggedQueuePool) = isready(pool.inq) || isready(pool.outq) || poo
#############################

"""
results(pool::LoggedQueuePool) -> result iterator
poolresults(pool::LoggedQueuePool) -> result iterator
Identical to [`results(pool::LoggedQueuePool)`](@ref).
Identical to [`poolresults(pool::LoggedQueuePool)`](@ref).
"""
results(pool::LoggedQueuePool) = ResultIterator(pool)
poolresults(pool::LoggedQueuePool) = ResultIterator(pool)



Expand Down
6 changes: 3 additions & 3 deletions src/qpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct ResultIterator
end

"""
results(pool::QueuePool) -> result iterator
poolresults(pool::QueuePool) -> result iterator
Returns an iterator over the `fetch`ed results of the pooled tasks.
Expand All @@ -160,7 +160,7 @@ julia> @async begin
close(pool)
end;
julia> for r in results(pool)
julia> for r in poolresults(pool)
println(r)
end
6
Expand All @@ -170,7 +170,7 @@ julia> for r in results(pool)
```
Note that the execution order across the threads is not guaranteed.
"""
results(pool::QueuePool) = ResultIterator(pool)
poolresults(pool::QueuePool) = ResultIterator(pool)

function Base.iterate(itr::ResultIterator, state=nothing)
x = iterate(itr.pool.outq, state)
Expand Down
8 changes: 4 additions & 4 deletions test/stacktests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end
put!(stack, item)
end

for result in results(pool)
for result in poolresults(pool)
push!(output, result)
if result % 3 == 0
put!(stack, TestObj(11))
Expand Down Expand Up @@ -61,7 +61,7 @@ end
put!(stack, item)
end

for result in results(pool)
for result in poolresults(pool)
push!(output, result)
if result % 3 == 0
put!(stack, TestObj(11))
Expand Down Expand Up @@ -93,7 +93,7 @@ end
put!(stack, item)
end

for result in results(pool)
for result in poolresults(pool)
push!(output, result)
if result % 3 == 0
put!(stack, TestObj(11))
Expand Down Expand Up @@ -127,7 +127,7 @@ end
put!(stack, item)
end

for result in results(pool)
for result in poolresults(pool)
push!(output, result)
if result % 3 == 0
put!(stack, TestObj(11))
Expand Down

0 comments on commit d6da10b

Please sign in to comment.