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

Unified Diff: src/pkg/once/once.go

Issue 180049: code review 180049: 1) Change default gofmt default settings for (Closed)
Patch Set: code review 180049: 1) Change default gofmt default settings for Created 15 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pkg/once/once_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/once/once.go
===================================================================
--- a/src/pkg/once/once.go
+++ b/src/pkg/once/once.go
@@ -9,8 +9,8 @@
import "sync"
type job struct {
- done bool;
- sync.Mutex; // should probably be sync.Notification or some such
+ done bool
+ sync.Mutex // should probably be sync.Notification or some such
}
var jobs = make(map[func()]*job)
@@ -37,23 +37,23 @@
// because the func() expression in the first creates a new
// func each time f runs, and each of those funcs is run once.
func Do(f func()) {
- joblock.Lock();
- j, present := jobs[f];
+ joblock.Lock()
+ j, present := jobs[f]
if !present {
// run it
- j = new(job);
- j.Lock();
- jobs[f] = j;
- joblock.Unlock();
- f();
- j.done = true;
- j.Unlock();
+ j = new(job)
+ j.Lock()
+ jobs[f] = j
+ joblock.Unlock()
+ f()
+ j.done = true
+ j.Unlock()
} else {
// wait for it
- joblock.Unlock();
+ joblock.Unlock()
if j.done != true {
- j.Lock();
- j.Unlock();
+ j.Lock()
+ j.Unlock()
}
}
}
« no previous file with comments | « no previous file | src/pkg/once/once_test.go » ('j') | no next file with comments »

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