And as Sean pointed out, the reason it is never run is that the object
> being cleaned up is still referenced (I didn’t verify this)
>
> On Apr 3, 2025, at 5:28 PM, Yaroslav Brustinov wrote:
>
>
>
> I was sure the doc means the case when a program exits *too quickly,*
> bef
t engels wrote:
> It states this in the API docs:
>
> "The cleanup(arg) call is not always guaranteed to run; in particular it
> is not guaranteed to run before program exit."
>
> On Apr 3, 2025, at 10:23 AM, Yaroslav Brustinov
> wrote:
>
> Hello, experts.
Hello, experts.
Given following code as example:
package main
import (
"fmt"
"io"
"runtime"
"sync/atomic"
"time"
)
type S struct {
foo int
}
var released1 atomic.Bool
var released2 atomic.Bool
func releaseCb(releaseFlag *atomic.Bool) {
fmt.Println("release CB")
releaseFlag.Store(true)
}
func