Skip to content

[Concurrency] Implement a builtin createAsyncTask() to create a new task #34627

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

Merged
merged 3 commits into from
Nov 10, 2020

Conversation

DougGregor
Copy link
Member

Builtin.createAsyncTask takes flags, an optional parent task, and an
async/throwing function to execute, and passes it along to the
swift_task_create_f entry point to create a new (potentially child)
task, returning the new task and its initial context.

…ask.

`Builtin.createAsyncTask` takes flags, an optional parent task, and an
async/throwing function to execute, and passes it along to the
`swift_task_create_f` entry point to create a new (potentially child)
task, returning the new task and its initial context.
The `createAsyncTask` entry point expects the parent task to be
"guaranteed" and the function to be "owned". However, that's not easy
to model in the operand ownership map, so we consider all operands to
be "guaranteed" and balance out the reference count when lowering the builtin.

This is an egregious hack that will create a little extra reference
count traffic.
@DougGregor
Copy link
Member Author

@swift-ci test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

I think I'll land this and clean things up later. There are a couple of moving pieces here.

@DougGregor DougGregor merged commit 6798ed1 into swiftlang:main Nov 10, 2020
@DougGregor DougGregor deleted the create-async-task-builtin branch November 10, 2020 04:40
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