Closed thekondor closed 1 year ago
That is not stated whether Wait() & Submit() for TaskGroupWithContext are allowed for usage from different execution threads. As end user I expected that it is.
Wait()
Submit()
TaskGroupWithContext
// thread 1 group.Submit(func() error { return errors.New("failed") }) // thread 2 group.Wait()
leads to race condition because of non-synchronized (write & read) operations to .err.
.err
The problem is detectable in 100% cases by a built-in race checker.
The change introduces usage of mutex to synchronize access to this variable at the above mentioned code flows.
Context
That is not stated whether
Wait()
&Submit()
forTaskGroupWithContext
are allowed for usage from different execution threads. As end user I expected that it is.Problem
leads to race condition because of non-synchronized (write & read) operations to
.err
.The problem is detectable in 100% cases by a built-in race checker.
PR
The change introduces usage of mutex to synchronize access to this variable at the above mentioned code flows.