Compare commits
No commits in common. "main" and "v0.0.1" have entirely different histories.
8
view.go
8
view.go
@ -20,7 +20,6 @@ type View[K comparable] struct {
|
|||||||
|
|
||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
reportCh chan report[K]
|
reportCh chan report[K]
|
||||||
doneCh chan struct{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func New[K comparable]() *View[K] {
|
func New[K comparable]() *View[K] {
|
||||||
@ -34,7 +33,6 @@ func NewForWriter[K comparable](w io.Writer) *View[K] {
|
|||||||
taskMap: map[K]struct{}{},
|
taskMap: map[K]struct{}{},
|
||||||
|
|
||||||
reportCh: make(chan report[K], 100),
|
reportCh: make(chan report[K], 100),
|
||||||
doneCh: make(chan struct{}, 1),
|
|
||||||
lastReports: map[K]report[K]{},
|
lastReports: map[K]report[K]{},
|
||||||
wg: &sync.WaitGroup{},
|
wg: &sync.WaitGroup{},
|
||||||
}
|
}
|
||||||
@ -65,8 +63,6 @@ func (v *View[K]) consumeReports(printReports bool) {
|
|||||||
v.print()
|
v.print()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v.doneCh <- struct{}{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *View[K]) SortFunc(f func(i, j K) bool) {
|
func (v *View[K]) SortFunc(f func(i, j K) bool) {
|
||||||
@ -100,7 +96,3 @@ func (v *View[K]) Done(task K) {
|
|||||||
|
|
||||||
v.wg.Done()
|
v.wg.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *View[K]) WaitForAllTasks() {
|
|
||||||
<-v.doneCh
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user