| // Copyright 2013 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| runtime.SetFinalizer(&f1, func(f *func()) { |
| atomic.AddInt64(&count, -1) |
| // Does not work with gccgo, due to partially conservative GC. |
| // Try to enable when we have fully precise GC. |
| if runtime.Compiler == "gccgo" { |
| for i := 0; i < 2*N; i++ { |
| time.Sleep(10 * time.Millisecond) |
| println(count, "out of", N, "finalizer are not called") |
| panic("not all finalizers are called") |