package
0.0.0-20240719213957-4380512ee660
Repository: https://github.com/feliux/go-patterns.git
Documentation: pkg.go.dev
# README
Barrier pattern
The barrier pattern in go involves synchronizing multiple goroutines by making them wait until all participating goroutines reach a common synchronization point (barrier) before proceeding further. This pattern is useful for coordinating parallel tasks where multiple stages of computation need to be completed before moving to the next phase. Go's sync package, specially sync.WaitGroup
, can be adapted to implement a barrier pattern.
Barriers synchronize multiple goroutines by forcing them to wait at a synchronization point until all goroutines reach that point.