runtime: implement local work queues (in preparation for new scheduler) R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7402047
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 2459199..61e33eb 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h
@@ -52,6 +52,7 @@ typedef struct Gobuf Gobuf; typedef union Lock Lock; typedef struct M M; +typedef struct P P; typedef struct Mem Mem; typedef union Note Note; typedef struct Slice Slice; @@ -312,6 +313,17 @@ uintptr end[]; }; +struct P +{ + Lock; + + // Queue of runnable goroutines. + G** runq; + int32 runqhead; + int32 runqtail; + int32 runqsize; +}; + // The m->locked word holds a single bit saying whether // external calls to LockOSThread are in effect, and then a counter // of the internal nesting depth of lockOSThread / unlockOSThread.