Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
90da10d7
Commit
90da10d7
authored
Jul 16, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chan bool offset bug
SVN=127537
parent
ac048ce7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
chan.c
src/runtime/chan.c
+8
-5
No files found.
src/runtime/chan.c
View file @
90da10d7
...
...
@@ -15,7 +15,8 @@ struct Hchan
uint32
dataqsiz
;
// size of the circular q
uint32
qcount
;
// total data in the q
uint32
eo
;
// vararg of element
uint32
po
;
// vararg of present bool
uint32
po1
;
// vararg of present bool in next structure
uint32
po2
;
// vararg of present bool in same structure
Alg
*
elemalg
;
// interface for element type
Link
*
senddataq
;
// pointer for sender
Link
*
recvdataq
;
// pointer for receiver
...
...
@@ -74,7 +75,8 @@ sys·newchan(uint32 elemsize, uint32 elemalg, uint32 hint,
// these calculations are compiler dependent
c
->
eo
=
rnd
(
sizeof
(
c
),
elemsize
);
c
->
po
=
rnd
(
c
->
eo
+
elemsize
,
1
);
c
->
po1
=
rnd
(
c
->
eo
+
elemsize
,
8
);
// next structure
c
->
po2
=
rnd
(
c
->
eo
+
elemsize
,
1
);
// same structure
ret
=
c
;
FLUSH
(
&
ret
);
...
...
@@ -90,7 +92,6 @@ sys·newchan(uint32 elemsize, uint32 elemalg, uint32 hint,
sys
·
printint
(
c
->
dataqsiz
);
prints
(
"
\n
"
);
}
}
// chansend1(hchan *chan any, elem any);
...
...
@@ -145,7 +146,8 @@ sys·chansend2(Hchan* c, ...)
G
*
gr
;
ae
=
(
byte
*
)
&
c
+
c
->
eo
;
ap
=
(
byte
*
)
&
c
+
c
->
po
;
ap
=
(
byte
*
)
&
c
+
c
->
po1
;
if
(
debug
)
{
prints
(
"chansend: chan="
);
sys
·
printpointer
(
c
);
...
...
@@ -230,7 +232,8 @@ sys·chanrecv2(Hchan* c, ...)
G
*
gs
;
ae
=
(
byte
*
)
&
c
+
c
->
eo
;
ap
=
(
byte
*
)
&
c
+
c
->
po
;
ap
=
(
byte
*
)
&
c
+
c
->
po2
;
if
(
debug
)
{
prints
(
"chanrecv2: chan="
);
sys
·
printpointer
(
c
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment