Re: [go-nuts] premature defer in method when using cgo

2016-11-10 Thread iakov . davydov
Hi, As far as I understand, os.Stdout & os.Stderr are not buffered. log.Debug writes to stderr. I replaced log.Debug with println, the result is the same. Cheers, Iakov P.S. Struggling with creating a minimal example; the results is not very stable. Will put it here if I will manage. On Thursda

Re: [go-nuts] premature defer in method when using cgo

2016-11-10 Thread Ian Lance Taylor
On Thu, Nov 10, 2016 at 3:18 AM, wrote: > > I don't have a minimal example yet, but this looks very suspicious. It seems > that sometimes defer called before the function finishes, if cgo code with > callbacks is called in it. > > Here's the code: > > func (n *NLOPT) Run(iterations int) { >

Re: [go-nuts] premature defer in method when using cgo

2016-11-10 Thread Jan Mercl
On Thu, Nov 10, 2016 at 3:31 PM wrote: > So defer is executed before the method exits. Does log.Debug flush its output before returning? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] premature defer in method when using cgo

2016-11-10 Thread iakov . davydov
Hi, I don't have a minimal example yet, but this looks very suspicious. It seems that sometimes defer called before the function finishes, if cgo code with callbacks is called in it. Here's the code: func (n *NLOPT) Run(iterations int) { log.Debug("entering Run method") ...