Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread Jérôme LAFORGE
Thx Giovanni, it is clear now. -- 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 options, visit https://groups.g

[go-nuts] network programming about go

2017-10-29 Thread 2891132love
I write this code in the follwings: package main import ( "fmt" "net" "os" ) func main() { service := ":5000" tcpAddr, err := net.ResolveTCPAddr("tcp", service) checkError(err) listener, err := net.ListenTCP("tcp", tcpAddr) checkError(err) for i := 0; i < 10; i++ { conn, err := listener.Accept()

[go-nuts] Is there a way or lib to read a binary into a sturct{len int32;data [len]int32}

2017-10-29 Thread hui zhang
type variastrt struct { len int32 data []int32 // data length = len [len]int32 } Is there a way or lib to read a binary into a this structure in one line code? how about more complicate struct ? type complicatestrt struct { len int32 strData []variastrt } -- You received this m

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread Michael Jones
it would be great to move to pcg. careful implementation here: https://github.com/MichaelTJones/pcg extensive use for quite a while On Sun, Oct 29, 2017 at 10:11 AM, wrote: > Il giorno domenica 29 ottobre 2017 17:49:39 UTC+1, T L ha scritto: >> >> >> >> On Sunday, October 29, 2017 at 3:47:43 A

[go-nuts] Re: concurrency programing about go

2017-10-29 Thread 2891132love
Yes, you're right.So how to solve it?? 在 2017年10月30日星期一 UTC+8下午12:37:49,Dave Cheney写道: > > Hello. I’m guessing that your tried calling twoprint(), but you’ve > probably found that nothing is printed to the screen before your program > exits. > > Is that correct? -- You received this message b

[go-nuts] concurrency programing about go

2017-10-29 Thread Dave Cheney
Hello. I’m guessing that your tried calling twoprint(), but you’ve probably found that nothing is printed to the screen before your program exits. Is that correct? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

[go-nuts] concurrency programing about go

2017-10-29 Thread 2891132love
I write some function and other things in the followings: var a string var once sync.Once func setup() { a = "hello,world" } func doprint() { once.Do(setup) fmt.Print(a) } func twoprint() { go doprint() go doprint() } the quwstion is how can I make use of function twoprint()?? Thank you

[go-nuts] golang.org/x/net/websocket, getting hot CPU while reading

2017-10-29 Thread Vladimir Gordeev
Hello everyone, I have a websocket handler like this: func motionEventsServer(ws *websocket.Conn) { var id string websocket.Message.Receive(ws, &id) for { data := motion{} websocket.JSON.Receive(ws, &data) deviceMap.Store(id, data) websocket.Message.S

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread rasky
Il giorno domenica 29 ottobre 2017 17:49:39 UTC+1, T L ha scritto: > > > > On Sunday, October 29, 2017 at 3:47:43 AM UTC-4, Sokolov Yura wrote: >> >> Why no one writes Go's version they've tested with? >> >> HEAD of master branch is uniform? >> > > 1.9.2 is a little unfair. Tip is fair. > Let me

Re: [go-nuts] An efficient algorithm to write binary data

2017-10-29 Thread DrGo
Thanks Michael, Here is the cleaner current version, thanks to your suggestion: //writeData loops over the field vectors and write their binary representation to an io.Writer func (sf *File) writeData(w io.Writer) error { if sf.NoObs == 0 { return nil } if len(sf.fields) == 0

Re: [go-nuts] An efficient algorithm to write binary data

2017-10-29 Thread DrGo
Michael, here is the cleaner (thanks to your suggestion) current version: //writeData loops over the field vectors and write their binary representation to an io.Writer func (sf *File) writeData(w io.Writer) error { if sf.NoObs == 0 { return nil } if len(sf.fields) == 0 {

[go-nuts] An efficient algorithm to write binary data

2017-10-29 Thread DrGo
Thanks Tamas, I agree re float32bits. I think the compiler will inline it. Right? Re binary.put*, I am essentially inlining their implementation and avoiding unnecessary use of reflection for serializing the floats. I am not sure I understand your point re the type switch, can you provide an e

[go-nuts] An efficient algorithm to write binary data

2017-10-29 Thread DrGo
Thanks, I agree re float32bits. I think the compiler will inline it. Right? Re binary.put*, I am essentially inlining their implementation and avoiding unnecessary use of reflection for serializing the floats. I am not sure I understand your point re the type switch, can you provide an example

[go-nuts] Re: [golang-dev] Subject: Go 1.9.2 and Go 1.8.5 are released

2017-10-29 Thread Michael Hudson-Doyle
On 26 October 2017 at 18:56, Chris Broadfoot wrote: > Nice! Thank you for maintaining these! > I hope people find them useful (I know quite a few people at Canonical are using them but I don't know if many people outside are using them), > BTW, if it helps, all tarballs are now gpg signed. (ad

RE: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread John Souvestre
Uniform fairness was my goal, not ordering the selection. A hard real-time program would require the deterministic latency this would provide. I agree that any program requiring an ordered selection probably is broken. Perhaps another method could be used to detect such code. John

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread Jesper Louis Andersen
On Sat, Oct 28, 2017 at 11:59 PM John Souvestre wrote: > If it were uniformly fair then you couldn’t guarantee picking every > channel once in a while. Statistically it would be become more and more > probable, but never 100%. > > > You are touching on the subject of there being different ways

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread T L
On Sunday, October 29, 2017 at 3:47:43 AM UTC-4, Sokolov Yura wrote: > > Why no one writes Go's version they've tested with? > > HEAD of master branch is uniform? > 1.9.2 is a little unfair. Tip is fair. -- You received this message because you are subscribed to the Google Groups "golang-nut

Re: [go-nuts] Re: Can I interpret the Go 1 memroy model as the following described?

2017-10-29 Thread T L
On Saturday, October 28, 2017 at 7:55:22 PM UTC-4, Keith Randall wrote: > > > > On Saturday, October 28, 2017 at 2:18:05 PM UTC-7, T L wrote: >> >> >> >> On Saturday, October 28, 2017 at 4:56:42 PM UTC-4, T L wrote: >>> >>> In my opinion, the memory model article should mention that if event A >

Fwd: [go-nuts] go/types#Check is not resolving external package source positions.

2017-10-29 Thread Keynan Pratt
-- Forwarded message -- From: Keynan Pratt Date: Sun, Oct 29, 2017 at 5:01 PM Subject: Re: [go-nuts] go/types#Check is not resolving external package source positions. To: roger peppe Thanks for the help Roger. On Sun, Oct 29, 2017 at 5:00 PM, Keynan Pratt wrote: > Can confir

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread Sokolov Yura
Why no one writes Go's version they've tested with? HEAD of master branch is uniform? -- 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...@goo

Re: [go-nuts] Re: select is still a little unfair if there are more than 4 cases?

2017-10-29 Thread 'Axel Wagner' via golang-nuts
Apart from practical concerns about how to implement determinism, the specification of randomness exists for a reason: It prevents programs from depending on any specific choice for correctness. (Which is why I asked above what the actual problem is if select isn't perfectly uniform but just "pret