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

[Merged by Bors] - Add is_finished to Task<T> #6444

Closed
wants to merge 2 commits into from
Closed

[Merged by Bors] - Add is_finished to Task<T> #6444

wants to merge 2 commits into from

Conversation

BeastLe9enD
Copy link
Contributor

Objective

In some scenarios it can be useful to check if a task has been finished without polling it. I added a function called is_finished to check if a task has been finished.

Solution

Since async_task supports it out of the box, it is just a simple wrapper function.


@james7132 james7132 added C-Enhancement A new feature A-Tasks Tools for parallel and async work labels Nov 2, 2022
@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed C-Enhancement A new feature S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Nov 2, 2022

/// Returns `true` if the current task is finished.
///
/// Note that in a multithreaded environment, this task can change finish immediately after calling this function.
Copy link
Member

Choose a reason for hiding this comment

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

"can change finish"? This is ungrammatical, but I can't quite figure out what's intended to give you a direct suggestion :)


/// Returns `true` if the current task is finished.
///
/// Note that in a multithreaded environment, this task can change finish immediately after calling this function.
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to see a sentence comparing this to polling, and explaining why you might want one vs the other.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Feedback on docs, but once that's cleaned up I'm happy to merge!

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

bors r+

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Nov 2, 2022
bors bot pushed a commit that referenced this pull request Nov 2, 2022
# Objective

In some scenarios it can be useful to check if a task has been finished without polling it. I added a function called `is_finished` to check if a task has been finished.

## Solution

Since `async_task` supports it out of the box, it is just a simple wrapper function.

---
@bors bors bot changed the title Add is_finished to Task<T> [Merged by Bors] - Add is_finished to Task<T> Nov 2, 2022
@bors bors bot closed this Nov 2, 2022
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

In some scenarios it can be useful to check if a task has been finished without polling it. I added a function called `is_finished` to check if a task has been finished.

## Solution

Since `async_task` supports it out of the box, it is just a simple wrapper function.

---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tasks Tools for parallel and async work C-Usability A simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants