Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions base/threadingconstructs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function threading_run(fun, static)
if !isempty(failed_tasks)
throw(CompositeException(map(TaskFailedException, failed_tasks)))
end
return map(Base.get_task_tls, tasks)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about simply:

Suggested change
return map(Base.get_task_tls, tasks)
return tasks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there other useful things inside the tasks?

Copy link
Member Author

@IanButterworth IanButterworth Mar 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that's nicer is that the show method for a vector of tasks is a lot tidier than a vector of dict. So running a threaded for loop in the repl would be tidier.

end

function _threadsfor(iter, lbody, schedule)
Expand Down Expand Up @@ -141,13 +142,13 @@ function _threadsfor(iter, lbody, schedule)
end
end
if $(schedule === :dynamic || schedule === :default)
threading_run(threadsfor_fun, false)
tlss = threading_run(threadsfor_fun, false)
elseif ccall(:jl_in_threaded_region, Cint, ()) != 0 # :static
error("`@threads :static` cannot be used concurrently or nested")
else # :static
threading_run(threadsfor_fun, true)
tlss = threading_run(threadsfor_fun, true)
end
nothing
tlss
end
end

Expand Down