From a7ff582cd13bf86c483b953e04962c4275ee2a0b Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Thu, 12 Dec 2024 14:49:40 +0200 Subject: [PATCH] Report if fuse was broken by a call to Break. --- fuse.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fuse.go b/fuse.go index 9926c67..dd2dcff 100644 --- a/fuse.go +++ b/fuse.go @@ -56,9 +56,13 @@ func (f *Fuse) Watch() <-chan struct{} { return f.c } -// Break breaks the fuse -func (f *Fuse) Break() { - f.Once(nil) +// Break breaks the fuse. It returns true if it was broken by this call. +func (f *Fuse) Break() bool { + broken := false + f.Once(func() { + broken = true + }) + return broken } // Once runs the callback and breaks the fuse