Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(117)

Delta Between Two Patch Sets: src/pkg/runtime/chan.h

Issue 160200044: [dev.power64] code review 160200044: build: merge default into dev.power64 (Closed)
Left Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 years, 4 months ago
Right Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/cgocall.go ('k') | src/pkg/runtime/chan.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #define MAXALIGN 8 5 #define MAXALIGN 8
6 6
7 typedef struct WaitQ WaitQ; 7 typedef struct WaitQ WaitQ;
8 typedef struct SudoG SudoG;
9 typedef struct Select Select; 8 typedef struct Select Select;
10 typedef struct Scase Scase; 9 typedef struct Scase Scase;
11
12 // Known to compiler.
13 // Changes here must also be made in src/cmd/gc/select.c's selecttype.
14 struct SudoG
15 {
16 G* g;
17 uint32* selectdone;
18 SudoG* link;
19 byte* elem; // data element
20 int64 releasetime;
21 };
22 10
23 struct WaitQ 11 struct WaitQ
24 { 12 {
25 SudoG* first; 13 SudoG* first;
26 SudoG* last; 14 SudoG* last;
27 }; 15 };
28 16
29 struct Hchan 17 struct Hchan
30 { 18 {
31 uintgo qcount; // total data in the q 19 uintgo qcount; // total data in the q
32 uintgo dataqsiz; // size of the circular q 20 uintgo dataqsiz; // size of the circular q
33 byte* buf; 21 byte* buf;
34 uint16 elemsize; 22 uint16 elemsize;
35 » bool» closed; 23 » uint32» closed;
36 Type* elemtype; // element type 24 Type* elemtype; // element type
37 uintgo sendx; // send index 25 uintgo sendx; // send index
38 uintgo recvx; // receive index 26 uintgo recvx; // receive index
39 WaitQ recvq; // list of recv waiters 27 WaitQ recvq; // list of recv waiters
40 WaitQ sendq; // list of send waiters 28 WaitQ sendq; // list of send waiters
41 » Lock; 29 » Mutex» lock;
42 }; 30 };
43 31
44 // Buffer follows Hchan immediately in memory. 32 // Buffer follows Hchan immediately in memory.
45 // chanbuf(c, i) is pointer to the i'th slot in the buffer. 33 // chanbuf(c, i) is pointer to the i'th slot in the buffer.
46 #define chanbuf(c, i) ((byte*)((c)->buf)+(uintptr)(c)->elemsize*(i)) 34 #define chanbuf(c, i) ((byte*)((c)->buf)+(uintptr)(c)->elemsize*(i))
47 35
48 enum 36 enum
49 { 37 {
50 debug = 0, 38 debug = 0,
51 39
52 // Scase.kind 40 // Scase.kind
53 CaseRecv, 41 CaseRecv,
54 CaseSend, 42 CaseSend,
55 CaseDefault, 43 CaseDefault,
56 }; 44 };
57 45
58 // Known to compiler. 46 // Known to compiler.
59 // Changes here must also be made in src/cmd/gc/select.c's selecttype. 47 // Changes here must also be made in src/cmd/gc/select.c's selecttype.
60 struct Scase 48 struct Scase
61 { 49 {
62 » SudoG» sg;» » » // must be first member (cast to Scase) 50 » void*» elem;» » » // data element
63 Hchan* chan; // chan 51 Hchan* chan; // chan
64 » byte*» pc;» » » // return pc 52 » uintptr»pc;» » » // return pc
65 uint16 kind; 53 uint16 kind;
66 uint16 so; // vararg of selected bool 54 uint16 so; // vararg of selected bool
67 bool* receivedp; // pointer to received bool (recv2) 55 bool* receivedp; // pointer to received bool (recv2)
56 int64 releasetime;
68 }; 57 };
69 58
70 // Known to compiler. 59 // Known to compiler.
71 // Changes here must also be made in src/cmd/gc/select.c's selecttype. 60 // Changes here must also be made in src/cmd/gc/select.c's selecttype.
72 struct Select 61 struct Select
73 { 62 {
74 uint16 tcase; // total count of scase[] 63 uint16 tcase; // total count of scase[]
75 uint16 ncase; // currently filled scase[] 64 uint16 ncase; // currently filled scase[]
76 uint16* pollorder; // case poll order 65 uint16* pollorder; // case poll order
77 Hchan** lockorder; // channel lock order 66 Hchan** lockorder; // channel lock order
78 Scase scase[1]; // one per case (in order of appearance) 67 Scase scase[1]; // one per case (in order of appearance)
79 }; 68 };
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b