Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

combine fiber abstractions from async_.rs and concurrent.rs#223

Merged
dicej merged 2 commits intomainfrom
dicej/unify-fiber-abstractions
Jun 18, 2025
Merged

combine fiber abstractions from async_.rs and concurrent.rs#223
dicej merged 2 commits intomainfrom
dicej/unify-fiber-abstractions

Conversation

@dicej
Copy link
Copy Markdown
Collaborator

@dicej dicej commented Jun 18, 2025

A long time ago, when I first started implementing CM async, I cut-and-pasted async_.rs's FiberFuture as StoreFiber and heavily modified it. Both have evolved separately since then, and now that the CM async work has generally stabilized it's time to unify them.

This creates a new runtime::fiber submodule which async_.rs and concurrent.rs share. The central type is StoreFiber, which is a more versatile version of FiberFuture, supporting fibers which can either retain exclusive access to the store across suspend points or release it, allowing the store to be used by the root event loop and/or other fibers to run before the original fiber resumes.

// in Rust is all about, though, right?
unsafe impl Send for StoreFiber<'_> {}
// SAFETY: TODO
unsafe impl Sync for StoreFiber<'_> {}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@alexcrichton I added this a long time ago to appease the compiler, but it deserves a second look. I can either try to remove the need for this (e.g. wrap it in a Mutex wherever we store it in concurrent.rs) or write another lengthy comment that justifies it similar to the Send impl above. What do you think?

@dicej dicej force-pushed the dicej/unify-fiber-abstractions branch from edddc3b to 9f22eda Compare June 18, 2025 19:03
A long time ago, when I first started implementing CM async, I cut-and-pasted
`async_.rs`'s `FiberFuture` as `StoreFiber` and heavily modified it.  Both have
evolved separately since then, and now that the CM async work has generally
stabilized it's time to unify them.

This creates a new `runtime::fiber` submodule which `async_.rs` and
`concurrent.rs` share.  The central type is `StoreFiber`, which is a more
versatile version of `FiberFuture`, supporting fibers which can either retain
exclusive access to the store across suspend points or release it, allowing the
store to be used by the root event loop and/or other fibers to run before the
original fiber resumes.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej force-pushed the dicej/unify-fiber-abstractions branch from 9f22eda to 89e49e1 Compare June 18, 2025 19:30
@dicej
Copy link
Copy Markdown
Collaborator Author

dicej commented Jun 18, 2025

I'll go ahead and merge this; feel free to comment here anyway -- I can address any issues in follow-up PRs.

@dicej dicej added this pull request to the merge queue Jun 18, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2025
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej force-pushed the dicej/unify-fiber-abstractions branch from ae04b01 to f049bef Compare June 18, 2025 21:44
@dicej dicej enabled auto-merge June 18, 2025 21:45
@dicej dicej added this pull request to the merge queue Jun 18, 2025
Merged via the queue into main with commit bf85653 Jun 18, 2025
44 checks passed
@dicej dicej deleted the dicej/unify-fiber-abstractions branch June 18, 2025 22:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant