File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -291,10 +291,10 @@ func coreStackTop(core uint32) uintptr {
291291
292292// These spinlocks are needed by the runtime.
293293var (
294- printLock = spinLock {id : 0 }
295- schedulerLock = spinLock {id : 1 }
296- atomicsLock = spinLock {id : 2 }
297- futexLock = spinLock {id : 3 }
294+ printLock = spinLock {id : 20 }
295+ schedulerLock = spinLock {id : 21 }
296+ atomicsLock = spinLock {id : 22 }
297+ futexLock = spinLock {id : 23 }
298298)
299299
300300// A hardware spinlock, one of the 32 spinlocks defined in the SIO peripheral.
@@ -311,15 +311,13 @@ func (l *spinLock) Lock() {
311311 // Wait for the lock to be available.
312312 spinlock := l .spinlock ()
313313 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.
314+ arm .Asm ("wfe" )
318315 }
319316}
320317
321318func (l * spinLock ) Unlock () {
322319 l .spinlock ().Set (0 )
320+ arm .Asm ("sev" )
323321}
324322
325323// Wait until a signal is received, indicating that it can resume from the
You can’t perform that action at this time.
0 commit comments