Skip to content

Commit 9025053

Browse files
committed
Add runtime.Gosched call in LockCore for improved scheduling
1 parent c00fc84 commit 9025053

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/machine/machine_rp2_cores.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
package machine
44

5+
import "runtime"
6+
57
const numCPU = 2 // RP2040 and RP2350 both have 2 cores
68

79
// LockCore sets the affinity for the current goroutine to the specified core.
@@ -35,6 +37,7 @@ func LockCore(core int) {
3537
panic("machine: core out of range")
3638
}
3739
machineLockCore(core)
40+
runtime.Gosched()
3841
}
3942

4043
// UnlockCore unpins the calling goroutine, allowing it to run on any available core.

0 commit comments

Comments
 (0)