What we have done
Now we have two kinds of SpinLock from R4L
See
|
#[cfg(not(CONFIG_RROS))] |
|
pub type SpinLock<T> = super::Lock<T, SpinLockBackend>; |
and
|
#[cfg(CONFIG_RROS)] |
|
pub struct SpinLock<T: ?Sized> { |
|
spin_lock: Opaque<bindings::spinlock>, |
|
|
|
/// Spinlocks are architecture-defined. So we conservatively require them to be pinned in case |
|
/// some architecture uses self-references now or in the future. |
|
_pin: PhantomPinned, |
|
|
|
data: UnsafeCell<T>, |
|
} |
What we should do next
There are some difference between them, including:
- How to init a SpinLock
- How to use a
Guard from SpinLock::lock()
Note: The two are not only different in API, but also in design. These differences need to be paid attention to during the porting process.
We should use the stable SpinLock and remove the unstable SpinLock
What we have done
Now we have two kinds of
SpinLockfrom R4LSee
RROS/rust/kernel/sync/lock/spinlock.rs
Lines 100 to 101 in a39ff9d
and
RROS/rust/kernel/sync/lock/spinlock.rs
Lines 179 to 188 in a39ff9d
What we should do next
There are some difference between them, including:
GuardfromSpinLock::lock()Note: The two are not only different in API, but also in design. These differences need to be paid attention to during the porting process.
We should use the stable
SpinLockand remove the unstableSpinLock