I'm new to the Go programming language and so far I really like it.
I'm currently trying to build Go bindings for Spread but i'm stuck at from my point of view a very simple thing:
I want my test program to run an poll Spread for new messages.
So what I need if something like this
n := C.SP_poll(mbox)
// if n is have something useful do something useful...
The problem is I get at least one CPU going to 100 percent.
So I started the read a lot about this and I see solutions like setting the GOMAXPROCS but then
I got multiple CPU doing something but I should not be that busy at all.
The C variant uses 0.0 CPU and thats more like it !
So far I have tried about every solution I can find but the best I could get was about 15% cpu use.
This was when I said to Go time.Sleep(whatever)
All the examples I have found and the videos i have watched are using example which uses
a for loop with a maximum of some number of cycles.
But I can't figure a way to get my application running not eating all my CPU just being there in the background polling to wait for something to do.
So I would be very glad with a proper solution so any advice would be very welcome !