Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Channel constructor keyword argument to @spawn new Task in parallel #32872

Merged

Conversation

NHDaly
Copy link
Member

@NHDaly NHDaly commented Aug 12, 2019

Adds a spawn= keyword argument to Channel(), which causes the new Task created for the provided func to be scheduled on any thread, in parallel, equivalent to creating the task via @spawn.

Defaults to false for backwards compatability.

This adds the param to the new constructor added in #32818, and updates the NEWS item.

NHDaly added 2 commits August 12, 2019 09:48
Add a parameter to the Channel constructor to allow the Tasks it creates
to be scheduled on multiple threads.

Examples:
```julia
    # Spawn a Task to handle each input request
    ch = Channel{String}(0, spawn=true) do ch
        handle_request(ch, request)
    end
```
@NHDaly NHDaly force-pushed the Channel-constructors-mulithreading branch from acc1d40 to 269a22b Compare August 12, 2019 13:51
@NHDaly
Copy link
Member Author

NHDaly commented Aug 12, 2019

@JeffBezanson This should be the last of my Channel constructor PRs. 😄 Thanks for the help reviewing them!

@ararslan ararslan requested a review from JeffBezanson August 12, 2019 16:49
NEWS.md Outdated Show resolved Hide resolved
base/channels.jl Outdated Show resolved Hide resolved
NHDaly and others added 4 commits August 13, 2019 17:23
- improve docstrings for Channel constructors

Co-Authored-By: Jeff Bezanson <[email protected]>
…nly constructor

Adds a manual check that users don't use the `spawn=` keyword argument
with the deprecated keyword arguments `ctype=` or `csize=`.
@NHDaly NHDaly changed the title Add Channel constructor kwparam to @spawn new Task in parallel Add Channel constructor keyword argument to @spawn new Task in parallel Aug 15, 2019
@JeffBezanson JeffBezanson merged commit af1979b into JuliaLang:master Aug 15, 2019
@NHDaly NHDaly deleted the Channel-constructors-mulithreading branch August 16, 2019 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants