mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
fix(rp2): switch spinlock busy loop to wfe
This commit is contained in:
@@ -311,15 +311,13 @@ func (l *spinLock) Lock() {
|
|||||||
// Wait for the lock to be available.
|
// Wait for the lock to be available.
|
||||||
spinlock := l.spinlock()
|
spinlock := l.spinlock()
|
||||||
for spinlock.Get() == 0 {
|
for spinlock.Get() == 0 {
|
||||||
// TODO: use wfe and send an event when unlocking so the CPU can go to
|
arm.Asm("wfe")
|
||||||
// sleep while waiting for the lock.
|
|
||||||
// Unfortunately when doing that, time.Sleep() seems to hang somewhere.
|
|
||||||
// This needs some debugging to figure out.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *spinLock) Unlock() {
|
func (l *spinLock) Unlock() {
|
||||||
l.spinlock().Set(0)
|
l.spinlock().Set(0)
|
||||||
|
arm.Asm("sev")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until a signal is received, indicating that it can resume from the
|
// Wait until a signal is received, indicating that it can resume from the
|
||||||
|
|||||||
Reference in New Issue
Block a user