Skip to content

Commit

Permalink
fix(boost): incorrect annotated wait group (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Aug 30, 2023
1 parent 56e48c9 commit a442d82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions boost/worker-pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// and hence should only ever be accessed by the worker pool GR in contrast to all the
// other members of WorkerPool. This is an experimental pattern, the purpose of which
// is the clearly indicate what state can be accessed in different concurrency contexts,
// to ensure future updates can be appliethe d with minimal cognitive overload.
// to ensure future updates can be applied with minimal cognitive overload.
//
// There is another purpose for privateWpInfo and that is to do with "confinement" as
// described on page 86 of CiG. The aim here is to use "lexical confinement" for
Expand Down Expand Up @@ -46,15 +46,15 @@ type WorkerPool[I, O any] struct {
noWorkers int
SourceJobsChIn JobStreamR[I]

Quitter AnnotatedWgQuitter
WaitAQ AnnotatedWgAQ
}

type NewWorkerPoolParams[I, O any] struct {
NoWorkers int
Exec ExecutiveFunc[I, O]
JobsCh chan Job[I]
CancelCh CancelStream
Quitter AnnotatedWgQuitter
WaitAQ AnnotatedWgAQ
}

func NewWorkerPool[I, O any](params *NewWorkerPoolParams[I, O]) *WorkerPool[I, O] {
Expand All @@ -75,7 +75,7 @@ func NewWorkerPool[I, O any](params *NewWorkerPoolParams[I, O]) *WorkerPool[I, O
noWorkers: noWorkers,
SourceJobsChIn: params.JobsCh,

Quitter: params.Quitter,
WaitAQ: params.WaitAQ,
}

return wp
Expand Down Expand Up @@ -112,7 +112,7 @@ func (p *WorkerPool[I, O]) run(
close(outputsChOut)
}

p.Quitter.Done(p.RoutineName)
p.WaitAQ.Done(p.RoutineName)
fmt.Printf("<--- WorkerPool.run (QUIT). 🧊🧊🧊\n")
}()
fmt.Printf("===> 🧊 WorkerPool.run ...(ctx:%+v)\n", ctx)
Expand Down
2 changes: 1 addition & 1 deletion boost/worker-pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (p *pipeline[I, O]) process(ctx context.Context, noWorkers int, executive b
Exec: executive,
JobsCh: p.producer.JobsCh,
CancelCh: make(boost.CancelStream),
Quitter: p.wgan,
WaitAQ: p.wgan,
})

go p.pool.Start(ctx, p.outputsCh)
Expand Down

0 comments on commit a442d82

Please sign in to comment.