Skip to content
Snippets Groups Projects
  • Boqun Feng's avatar
    d9d209df
    rust: sync: lock: Add `Backend::BackendInContext` · d9d209df
    Boqun Feng authored and Daniel Almeida's avatar Daniel Almeida committed
    
    `SpinLock`'s backend can be used for `SpinLockIrq`, if the interrupts
    are disabled. And it actually provides performance gains since
    interrupts are not needed to be disabled anymore. So add
    `Backend::BackendInContext` to describe the case where one backend can
    be used for another. Use the it to implement the `lock_with()` so that
    `SpinLockIrq` can avoid disabling interrupts by using `SpinLock`'s
    backend.
    
    Signed-off-by: default avatarBoqun Feng <boqun.feng@gmail.com>
    d9d209df
    History
    rust: sync: lock: Add `Backend::BackendInContext`
    Boqun Feng authored and Daniel Almeida's avatar Daniel Almeida committed
    
    `SpinLock`'s backend can be used for `SpinLockIrq`, if the interrupts
    are disabled. And it actually provides performance gains since
    interrupts are not needed to be disabled anymore. So add
    `Backend::BackendInContext` to describe the case where one backend can
    be used for another. Use the it to implement the `lock_with()` so that
    `SpinLockIrq` can avoid disabling interrupts by using `SpinLock`'s
    backend.
    
    Signed-off-by: default avatarBoqun Feng <boqun.feng@gmail.com>