Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
cc99ba0a
Commit
cc99ba0a
authored
Apr 06, 2010
by
David Symonds
Committed by
Andrew Gerrand
Apr 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/go_mem: remove semicolons
R=adg CC=golang-dev
https://golang.org/cl/893041
parent
d89b357f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
47 deletions
+47
-47
doc/go_mem.html
doc/go_mem.html
+47
-47
No files found.
doc/go_mem.html
View file @
cc99ba0a
...
@@ -126,15 +126,15 @@ For example, in this program:
...
@@ -126,15 +126,15 @@ For example, in this program:
</p>
</p>
<pre>
<pre>
var a string
;
var a string
func f() {
func f() {
print(a)
;
print(a)
}
}
func hello() {
func hello() {
a = "hello, world"
;
a = "hello, world"
go f()
;
go f()
}
}
</pre>
</pre>
...
@@ -166,14 +166,14 @@ var c = make(chan int, 10)
...
@@ -166,14 +166,14 @@ var c = make(chan int, 10)
var a string
var a string
func f() {
func f() {
a = "hello, world"
;
a = "hello, world"
c
<
- 0
;
c
<
- 0
}
}
func main() {
func main() {
go f()
;
go f()
<
-c
;
<
-c
print(a)
;
print(a)
}
}
</pre>
</pre>
...
@@ -199,16 +199,16 @@ var c = make(chan int)
...
@@ -199,16 +199,16 @@ var c = make(chan int)
var a string
var a string
func f() {
func f() {
a = "hello, world"
;
a = "hello, world"
<
-c
;
<
-c
}
}
</pre>
</pre>
<pre>
<pre>
func main() {
func main() {
go f()
;
go f()
c
<
- 0
;
c
<
- 0
print(a)
;
print(a)
}
}
</pre>
</pre>
...
@@ -247,15 +247,15 @@ var l sync.Mutex
...
@@ -247,15 +247,15 @@ var l sync.Mutex
var a string
var a string
func f() {
func f() {
a = "hello, world"
;
a = "hello, world"
l.Unlock()
;
l.Unlock()
}
}
func main() {
func main() {
l.Lock()
;
l.Lock()
go f()
;
go f()
l.Lock()
;
l.Lock()
print(a)
;
print(a)
}
}
</pre>
</pre>
...
@@ -295,17 +295,17 @@ In this program:
...
@@ -295,17 +295,17 @@ In this program:
var a string
var a string
func setup() {
func setup() {
a = "hello, world"
;
a = "hello, world"
}
}
func doprint() {
func doprint() {
once.Do(setup)
;
once.Do(setup)
print(a)
;
print(a)
}
}
func twoprint() {
func twoprint() {
go doprint()
;
go doprint()
go doprint()
;
go doprint()
}
}
</pre>
</pre>
...
@@ -331,18 +331,18 @@ In this program:
...
@@ -331,18 +331,18 @@ In this program:
var a, b int
var a, b int
func f() {
func f() {
a = 1
;
a = 1
b = 2
;
b = 2
}
}
func g() {
func g() {
print(b)
;
print(b)
print(a)
;
print(a)
}
}
func main() {
func main() {
go f()
;
go f()
g()
;
g()
}
}
</pre>
</pre>
...
@@ -365,20 +365,20 @@ var a string
...
@@ -365,20 +365,20 @@ var a string
var done bool
var done bool
func setup() {
func setup() {
a = "hello, world"
;
a = "hello, world"
done = true
;
done = true
}
}
func doprint() {
func doprint() {
if !done {
if !done {
once.Do(setup)
;
once.Do(setup)
}
}
print(a)
;
print(a)
}
}
func twoprint() {
func twoprint() {
go doprint()
;
go doprint()
go doprint()
;
go doprint()
}
}
</pre>
</pre>
...
@@ -398,15 +398,15 @@ var a string
...
@@ -398,15 +398,15 @@ var a string
var done bool
var done bool
func setup() {
func setup() {
a = "hello, world"
;
a = "hello, world"
done = true
;
done = true
}
}
func main() {
func main() {
go setup()
;
go setup()
for !done {
for !done {
}
}
print(a)
;
print(a)
}
}
</pre>
</pre>
...
@@ -427,22 +427,22 @@ There are subtler variants on this theme, such as this program.
...
@@ -427,22 +427,22 @@ There are subtler variants on this theme, such as this program.
<pre>
<pre>
type T struct {
type T struct {
msg string
;
msg string
}
}
var g *T
var g *T
func setup() {
func setup() {
t := new(T)
;
t := new(T)
t.msg = "hello, world"
;
t.msg = "hello, world"
g = t
;
g = t
}
}
func main() {
func main() {
go setup()
;
go setup()
for g == nil {
for g == nil {
}
}
print(g.msg)
;
print(g.msg)
}
}
</pre>
</pre>
...
...
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