You mean something like this?
func (b *RingBuf) ReadWait(min uint32, timeout time.Duration) bool {
if min == 0 {
min = 1
}
if b.ReadAvail() >= min {
return true
}
if timeout.Nanoseconds() == 0 {
return false
}
const pollPeriod = 100 * t
For several millions of goroutines - yes I think it matters.
If you're going to sleep, does it matter if time.Sleep has a cost?
--
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, sen
Hi.
I'd like to write function with spin-loop like this:
func readWait(timeout time.Duration) bool {
deadline := Nanotime() + timeout.Nanoseconds()
for {
if readAvail() {
return true
}
if Nanotime() >= deadline {
return false
}
runtime.Goshed()
}
}
But runtime.nanotime() is not exported. How can
Sorry my bad. Forget to add "in many cases" to last sentence.
https://play.golang.org/p/7MtoscXiFo
воскресенье, 17 июля 2016 г., 2:53:15 UTC+3 пользователь kortschak написал:
>
> On Sat, 2016-07-16 at 15:36 -0700, pi wrote:
> > `type` is not `typedef` in Go. `type` int
`type` is not `typedef` in Go. `type` introduces completely new type.
Fortunately, Go can cast these types to base type silently, i.e. explicict
cast int(valueOfTI) is unnecessary.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe
user 0m5.728s
sys 0m0.572s
go (go1.7rc1 linux/amd64, test is modified to use mmapped pools:
https://github.com/pi/goal/blob/master/internal/tests/benchmarkgame-binarytrees/binarytrees.go):
real 0m2.152s
user 0m5.992s
sys 0m0.328s
--
You received this message because you are subscribed to the G
This is a syntatic sugar: v.Func() on non-pointer receiver is equivalent to
(&v).Func()
суббота, 16 июля 2016 г., 10:42:22 UTC+3 пользователь T L написал:
>
> is there any logic here? Or just a hard rule?
>
--
You received this message because you are subscribed to the Google Groups
"golang-nu