Add adds delta, which may be negative, to the WaitGroup counter.
Add adds delta, which may be negative, to the WaitGroup counter. If the counter becomes zero, all waiters wake up and can continue.
If the counter goes negative, the NegativeWaitGroupCounter
exception is thrown at the current thread
and all waiters.
Await blocks until the WaitGroup counter is zero.
Await blocks until the WaitGroup counter is zero.
In GoLang the corresponding method is wait()
. However, in Java wait()
is a method of Object
and is used
for implementation of monitors, and cannot be overridden. Therefore, this method is named await()
instead.
If the counter goes negative, the NegativeWaitGroupCounter
exception is thrown.
Done decrements the WaitGroup counter by one.
Done decrements the WaitGroup counter by one.
If the counter goes negative, the NegativeWaitGroupCounter
exception is thrown at the current thread
and all waiters.
WaitGroup is a synchronization primitive ported from GoLang allows one or more threads to wait until a set of operations completes.