jamesmunns / grounded

Building blocks for handling potentially unsafe statics.
Apache License 2.0
7 stars 4 forks source link

Loosen Sync/Send bounds for `GroundedCell` #7

Open jamesmunns opened 4 months ago

jamesmunns commented 4 months ago
`UnsafeCell<u32>` cannot be shared between threads safely
within `PacketQueue<4, 4>`, the trait `Sync` is not implemented for `UnsafeCell<u32>`, which is required by `GroundedCell<PacketQueue<4, 4>>: Sync`
required because it appears within the type `[embassy_stm32::eth::_version::descriptors::TDes; 4]`
required for `GroundedCell<PacketQueue<4, 4>>` to implement `Sync`
shared static variables must have a type that implements `Sync`

Right now, GroundedCell is only Sync if T: Sync. This is probably too strict of a requirement for grounded cell, as users are intended to provide their own synchronization anyway.

If all accessor methods are unsafe, it's probably fine if we relax this substantially, but we will need to document this in SAFETY requirements for the various APIs.