diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-09-15 18:45:21 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-15 18:45:21 +0000 |
| commit | 5a158b94bde3a5fee096be213d2afede06d9f019 (patch) | |
| tree | 9b9b90375126b3c246b0b809c99f82fa954b3d9d /embassy-executor/src/arch | |
| parent | c091ed2f63da1c2135a84b7bfeb2003514c02526 (diff) | |
| parent | b9d4b18f14ad477c4b554498282ac467ff9cb823 (diff) | |
Merge pull request #1896 from haileys/inline-never-for-rvo
Write to TaskStorage::future via never-inlined fn to encourage RVO
Diffstat (limited to 'embassy-executor/src/arch')
| -rw-r--r-- | embassy-executor/src/arch/wasm.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/embassy-executor/src/arch/wasm.rs b/embassy-executor/src/arch/wasm.rs index 934fd69e5..15aed867a 100644 --- a/embassy-executor/src/arch/wasm.rs +++ b/embassy-executor/src/arch/wasm.rs | |||
| @@ -73,9 +73,10 @@ mod thread { | |||
| 73 | pub fn start(&'static mut self, init: impl FnOnce(Spawner)) { | 73 | pub fn start(&'static mut self, init: impl FnOnce(Spawner)) { |
| 74 | unsafe { | 74 | unsafe { |
| 75 | let executor = &self.inner; | 75 | let executor = &self.inner; |
| 76 | self.ctx.closure.write(Closure::new(move |_| { | 76 | let future = Closure::new(move |_| { |
| 77 | executor.poll(); | 77 | executor.poll(); |
| 78 | })); | 78 | }); |
| 79 | self.ctx.closure.write_in_place(|| future); | ||
| 79 | init(self.inner.spawner()); | 80 | init(self.inner.spawner()); |
| 80 | } | 81 | } |
| 81 | } | 82 | } |
