runtime: move mainExited boolean

This variable is only necessary on the cooperative and none scheduler.
It is not used on the threads scheduler.

The reason for moving is that the upcoming multicore baremetal scheduler
also needs mainExited but of a different type: an atomic variable
instead of a plain boolean.
This commit is contained in:
Ayke van Laethem
2025-04-07 10:09:29 +02:00
committed by Ron Evans
parent 95ee572b4d
commit 3f8a110e4a
3 changed files with 6 additions and 2 deletions
-2
View File
@@ -4,8 +4,6 @@ import "internal/task"
const schedulerDebug = false
var mainExited bool
var timerQueue *timerNode
// Simple logging, for debugging.
+3
View File
@@ -27,6 +27,9 @@ const hasScheduler = true
// concurrency, it does not have parallelism.
const hasParallelism = false
// Set to true after main.main returns.
var mainExited bool
// Queues used by the scheduler.
var (
runqueue task.Queue
+3
View File
@@ -9,6 +9,9 @@ const hasScheduler = false
// No goroutines are allowed, so there's no parallelism anywhere.
const hasParallelism = false
// Set to true after main.main returns.
var mainExited bool
// run is called by the program entry point to execute the go program.
// With the "none" scheduler, init and the main function are invoked directly.
func run() {