This commit is contained in:
Mike Schwörer 2022-11-30 23:38:42 +01:00
parent b1e3891256
commit 52f7f6e690
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -56,6 +56,12 @@ func (a *AtomicBool) Wait(waitFor bool) {
}
}
func (a *AtomicBool) WaitWithTimeout(timeout time.Duration, waitFor bool) error {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
return a.WaitWithContext(ctx, waitFor)
}
func (a *AtomicBool) WaitWithContext(ctx context.Context, waitFor bool) error {
if err := ctx.Err(); err != nil {
return err