From 0fa69b197f6531d8b7356532630d0053fe76012a Mon Sep 17 00:00:00 2001 From: qydysky Date: Tue, 7 Nov 2023 21:08:46 +0800 Subject: [PATCH] 1 --- ctx/Ctx.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ctx/Ctx.go b/ctx/Ctx.go index 80e19cd..c88caa5 100644 --- a/ctx/Ctx.go +++ b/ctx/Ctx.go @@ -91,3 +91,12 @@ func WaitCtx(ctx context.Context) (dctx context.Context, done func()) { } } } + +func Done(ctx context.Context) bool { + select { + case <-ctx.Done(): + return true + default: + } + return false +} -- 2.39.2