From 526200345cd6b1e1449f7adb62f05410ff01a44a Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Mon, 14 Jul 2008 14:33:39 -0700 Subject: synch chan SVN=127055 --- src/runtime/runtime.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/runtime/runtime.h') diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 4273f16eac..0b2e8ed975 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -42,6 +42,7 @@ typedef struct G G; typedef struct M M; typedef struct Stktop Stktop; typedef struct Alg Alg; +typedef struct WaitQ WaitQ; /* * per cpu declaration @@ -57,6 +58,7 @@ enum // G status Gidle, Grunnable, + Gwaiting, Gdead, }; enum @@ -104,10 +106,12 @@ struct G byte* stackguard; // must not move byte* stackbase; // must not move Gobuf sched; - G* link; + G* alllink; // on allq + G* qlink; // on wait q int32 status; int32 pri; int32 goid; + byte elem[8]; // transfer element for chan }; struct M { @@ -121,7 +125,12 @@ struct M int32 siz1; int32 siz2; }; -struct Stktop +struct WaitQ +{ + G* first; + G* last; +}; +struct Stktop { uint8* oldbase; uint8* oldsp; @@ -166,6 +175,8 @@ int32 findnull(int8*); void dump(byte*, int32); int32 runetochar(byte*, int32); int32 chartorune(uint32*, byte*); +G* dequeue(WaitQ*); +void enqueue(WaitQ*, G*); /* * very low level c-called -- cgit v1.3-5-g45d5