4 ms·
Rading through it... how do I know whether data.lock() is a spinlock or mutex, or whether it saves flags or not?
by megous 5y ago
Rading through it... how do I know whether data.lock() is a spinlock or mutex, or whether it saves flags or not?
- db48x 5y agoFrom the type. `data` is a `&Ref<DeviceData>` which means it is a smart pointer to something of type `DeviceData`. `DeviceData` is defined in this module as `type DeviceData = device::Data<PL061Registrations, PL061Resources, IrqDisableSpinLock<PL061Data>>`. I would have to peek at `device::Data` to be sure, but my supposition is that the lock method acts on the `IrqDisableSpinLock` type. I assume that the name is meaningful, making this one a spinlock that disables irqs. This lets each driver using `device::Data` supply the most appropriate type of lock.