Skip to content

Conversation

@JamesHuard
Copy link
Contributor

Embassy upstream recently fixed accidentally adding Sync to non-Sync types: embassy-rs/embassy#4320

In preparation to fix #361, added a drop-in replacement for Cell where moving to a proper primitive usage such as embassy_sync::mutex::Mutex is untenable. This also refactors the intrusive_list to utilize this new SyncCell type, allowing it to be used directly without any containers.

Note that in most cases SyncCell is not the best solution. If it is possible, proper synchronization primitives should be leveraged.

A critical section was used as opposed to a blocking_mutex type, as blocking_mutex is non-re-entrant. This allows the most flexibility in supporting scenarios with SyncCell, and does not require permutated get and set implementations based on mutex backing type.

In short:

  • New SyncCell type introduced to unblock ingesting embassy upstream Sync fix
  • We should use it sparingly
  • IntrusiveList was updated to use this new type, allowing it to be allocated statically without any errors

@JamesHuard JamesHuard self-assigned this Jun 20, 2025
@JamesHuard JamesHuard requested a review from a team as a code owner June 20, 2025 18:14
@JamesHuard JamesHuard force-pushed the jimi/sync-intrusive-list branch from 108160e to 1105e38 Compare June 20, 2025 18:14
@JamesHuard JamesHuard force-pushed the jimi/sync-intrusive-list branch from 1105e38 to caa059d Compare June 20, 2025 18:17
@JamesHuard JamesHuard enabled auto-merge (squash) June 20, 2025 18:30
gjpmsft
gjpmsft previously approved these changes Jun 20, 2025
@JamesHuard JamesHuard disabled auto-merge June 20, 2025 19:10
@JamesHuard JamesHuard requested review from asasine and wmmc88 June 20, 2025 19:20
JamesHuard and others added 3 commits June 20, 2025 14:57
add where T:Send {} back

Co-authored-by: Melvin Wang <melvin.mc.wang@gmail.com>
@JamesHuard JamesHuard enabled auto-merge (squash) June 23, 2025 15:14
@JamesHuard JamesHuard requested a review from wmmc88 June 23, 2025 15:14
@JamesHuard JamesHuard requested a review from a team June 23, 2025 15:33
@JamesHuard JamesHuard merged commit 48dd747 into OpenDevicePartnership:main Jun 23, 2025
22 checks passed
@JamesHuard JamesHuard deleted the jimi/sync-intrusive-list branch June 23, 2025 16:40
@jeffglaum jeffglaum moved this to Done in Embedded Controller Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Failure to compile with latest embassy-sync

4 participants