Renaming busy => active

This commit is contained in:
Alex Yatskov 2015-12-17 23:17:55 +09:00
parent e11181807f
commit 0150862216
2 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ type goldsmith struct {
stages []*stage stages []*stage
refs map[string]bool refs map[string]bool
mtx sync.Mutex mtx sync.Mutex
busy int64 active int64
stalled int64 stalled int64
} }
@ -58,7 +58,7 @@ func (gs *goldsmith) queueFiles(target uint) {
for path := range files { for path := range files {
for { for {
if gs.busy-gs.stalled >= int64(target) { if gs.active-gs.stalled >= int64(target) {
time.Sleep(time.Millisecond) time.Sleep(time.Millisecond)
} else { } else {
break break
@ -128,7 +128,7 @@ func (gs *goldsmith) cleanupFiles() {
func (gs *goldsmith) exportFile(file *File) { func (gs *goldsmith) exportFile(file *File) {
defer func() { defer func() {
file.Buff = *bytes.NewBuffer(nil) file.Buff = *bytes.NewBuffer(nil)
atomic.AddInt64(&gs.busy, -1) atomic.AddInt64(&gs.active, -1)
}() }()
if file.Err != nil { if file.Err != nil {
@ -223,7 +223,7 @@ func (gs *goldsmith) chain(s *stage, p Plugin) {
dispatch(f) dispatch(f)
} else { } else {
f.Buff = *bytes.NewBuffer(nil) f.Buff = *bytes.NewBuffer(nil)
atomic.AddInt64(&gs.busy, -1) atomic.AddInt64(&gs.active, -1)
} }
}(file) }(file)
} }

View File

@ -29,7 +29,7 @@ func (s *stage) RefFile(path string) {
} }
func (s *stage) AddFile(file *File) { func (s *stage) AddFile(file *File) {
atomic.AddInt64(&s.gs.busy, 1) atomic.AddInt64(&s.gs.active, 1)
s.output <- file s.output <- file
} }