From 52f7f6e690196a78ef83a17a5f6804d447ab2596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 30 Nov 2022 23:38:42 +0100 Subject: [PATCH] v0.0.26 --- syncext/atomic.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/syncext/atomic.go b/syncext/atomic.go index 0e65b74..f95ad59 100644 --- a/syncext/atomic.go +++ b/syncext/atomic.go @@ -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