We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d8afa2 commit 3dce224Copy full SHA for 3dce224
src/runtime/runtime_rp2.go
@@ -311,15 +311,13 @@ func (l *spinLock) Lock() {
311
// Wait for the lock to be available.
312
spinlock := l.spinlock()
313
for spinlock.Get() == 0 {
314
- // TODO: use wfe and send an event when unlocking so the CPU can go to
315
- // sleep while waiting for the lock.
316
- // Unfortunately when doing that, time.Sleep() seems to hang somewhere.
317
- // This needs some debugging to figure out.
+ arm.Asm("wfe")
318
}
319
320
321
func (l *spinLock) Unlock() {
322
l.spinlock().Set(0)
+ arm.Asm("sev")
323
324
325
// Wait until a signal is received, indicating that it can resume from the
0 commit comments