Re: [go-nuts] cgo and time.After

2018-05-20 Thread Chris Burkert
Dear Jakob and all, indeed I was blind. This works like a charm: amount := 42 remaining := amount ticker := time.NewTicker(5 * time.Second) defer ticker.Stop() for remaining > 0 { select { case <-ticker.C: fmt.Printf("Progress: %d left from %d\n", re

Re: [go-nuts] cgo and time.After

2018-05-19 Thread Chris Burkert
Jakob, I think you’re right. I am going to test this as soon as I am back home. After all I am a beginner in this area and it seems this one fooled me. I’ll send an update tomorrow. thanks - Chris Jakob Borg schrieb am Sa. 19. Mai 2018 um 21:15: > On 19 May 2018, at 16:25, Chris Burkert wrote:

Re: [go-nuts] cgo and time.After

2018-05-19 Thread Jakob Borg
On 19 May 2018, at 16:25, Chris Burkert wrote: > > case <-time.After(5 * time.Second): > fmt.Printf("Progress: %d left from %d\n", remaining, amount) It's not super clear from your post if you're aware of this already, but this case will only fire after the select has been blocked f

[go-nuts] cgo and time.After

2018-05-19 Thread Tamás Gulácsi
Show the code! This should not be cgo error, but user error! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more op

[go-nuts] cgo and time.After

2018-05-19 Thread Chris Burkert
Dear Gophers, I am working on a small database tool which checks a database for inconsistencies. It does that by calling a stored procedure via sql. Unfortunately the database client is available as C-library only but luckily there is a go driver for the database/sql package so at least it fee