/* * Read-write spinlocks, allowing multiple readers but only one writer. * * NOTE! it is quite common to have readers in interrupts but no interrupt * writers. For those circumstances we can "mix" irq-safe locks - any writer * needs to get a irq-safe write-lock, but readers can get non-irqsafe * read-locks.
*/
staticinlinevoid arch_read_lock(arch_rwlock_t *rw)
{ unsigned old; do old = rw->lock; while (!old || __sl_cas(&rw->lock, old, old-1) != old);
}
staticinlinevoid arch_read_unlock(arch_rwlock_t *rw)
{ unsigned old; do old = rw->lock; while (__sl_cas(&rw->lock, old, old+1) != old);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.