Skip to content

Loosen lifetime requirements for single-threaded Scope::spawn to match the multi-threaded version.#12073

Merged
james7132 merged 1 commit intobevyengine:mainfrom
chescock:scope-lifetimes
Feb 24, 2024
Merged

Loosen lifetime requirements for single-threaded Scope::spawn to match the multi-threaded version.#12073
james7132 merged 1 commit intobevyengine:mainfrom
chescock:scope-lifetimes

Conversation

@chescock
Copy link
Contributor

Objective

Scope::spawn, Scope::spawn_on_external, and Scope::spawn_on_scope have different signatures depending on whether the multi-threaded feature is enabled. The single-threaded version has a stricter signature that prevents sending the Scope itself to spawned tasks.

Solution

Changed the lifetime constraints in the single-threaded signatures from 'env to 'scope to match the multi-threaded version.

This was split off from #11906.

…tch the multi-threaded version.

This allows the scope itself to be sent to spawned tasks.
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Feb 24, 2024
@hymm hymm 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 Feb 24, 2024
@james7132 james7132 added this pull request to the merge queue Feb 24, 2024
Merged via the queue into bevyengine:main with commit 52f88e5 Feb 24, 2024
msvbg pushed a commit to msvbg/bevy that referenced this pull request Feb 26, 2024
…tch the multi-threaded version. (bevyengine#12073)

# Objective

`Scope::spawn`, `Scope::spawn_on_external`, and `Scope::spawn_on_scope`
have different signatures depending on whether the `multi-threaded`
feature is enabled. The single-threaded version has a stricter signature
that prevents sending the `Scope` itself to spawned tasks.

## Solution

Changed the lifetime constraints in the single-threaded signatures from
`'env` to `'scope` to match the multi-threaded version.

This was split off from bevyengine#11906.
msvbg pushed a commit to msvbg/bevy that referenced this pull request Feb 26, 2024
…tch the multi-threaded version. (bevyengine#12073)

# Objective

`Scope::spawn`, `Scope::spawn_on_external`, and `Scope::spawn_on_scope`
have different signatures depending on whether the `multi-threaded`
feature is enabled. The single-threaded version has a stricter signature
that prevents sending the `Scope` itself to spawned tasks.

## Solution

Changed the lifetime constraints in the single-threaded signatures from
`'env` to `'scope` to match the multi-threaded version.

This was split off from bevyengine#11906.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior 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.

4 participants