mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
iter, runtime: add coroutine support
The exported API is only available with GOEXPERIMENT=rangefunc. This will let Go 1.22 users who want to experiment with rangefuncs access an efficient implementation of iter.Pull and iter.Pull2. For #61897. Change-Id: I6ef5fa8f117567efe4029b7b8b0f4d9b85697fb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/543319 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
459cd35ec0
commit
a9c9cc07ac
11 changed files with 475 additions and 6 deletions
|
|
@ -483,6 +483,7 @@ type g struct {
|
|||
// inMarkAssist indicates whether the goroutine is in mark assist.
|
||||
// Used by the execution tracer.
|
||||
inMarkAssist bool
|
||||
coroexit bool // argument to coroswitch_m
|
||||
|
||||
raceignore int8 // ignore race detection events
|
||||
nocgocallback bool // whether disable callback from C
|
||||
|
|
@ -507,6 +508,8 @@ type g struct {
|
|||
timer *timer // cached timer for time.Sleep
|
||||
selectDone atomic.Uint32 // are we participating in a select and did someone win the race?
|
||||
|
||||
coroarg *coro // argument during coroutine transfers
|
||||
|
||||
// goroutineProfiled indicates the status of this goroutine's stack for the
|
||||
// current in-progress goroutine profile
|
||||
goroutineProfiled goroutineProfileStateHolder
|
||||
|
|
@ -1124,6 +1127,7 @@ const (
|
|||
waitReasonFlushProcCaches // "flushing proc caches"
|
||||
waitReasonTraceGoroutineStatus // "trace goroutine status"
|
||||
waitReasonTraceProcStatus // "trace proc status"
|
||||
waitReasonCoroutine // "coroutine"
|
||||
)
|
||||
|
||||
var waitReasonStrings = [...]string{
|
||||
|
|
@ -1162,6 +1166,7 @@ var waitReasonStrings = [...]string{
|
|||
waitReasonFlushProcCaches: "flushing proc caches",
|
||||
waitReasonTraceGoroutineStatus: "trace goroutine status",
|
||||
waitReasonTraceProcStatus: "trace proc status",
|
||||
waitReasonCoroutine: "coroutine",
|
||||
}
|
||||
|
||||
func (w waitReason) String() string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue