515 B
515 B
07 — Współbieżność (goroutines, channels, sync.WaitGroup, context)
Zadania (concurrency.go)
ParallelSum(chunks [][]int) int— policz sumę każdego kawałka równolegle w goroutines (użyj kanału lubsync.WaitGroup+sync/atomic/ mutex) i zwróć łączną sumę.WaitOrCancel(ctx context.Context, ch <-chan string) (string, error)— użyjselectnachictx.Done().
Uruchomienie testów (z -race!)
make test PKG=./exercises/01-core/07-concurrency