Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Dave Cheney
On 29 Dec 2017, at 18:01, Caleb Spare wrote: >>> This expression: >>> >>> atomic.StoreUint32(&o.done, 1) >>> >>> does not just take the address of o.done. It also executes the >>> StoreUint32 function, which is defined by the sync/atomic >>> documentation to behave like '*o.done = 1'; i.e., i

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Caleb Spare
>> This expression: >> >> atomic.StoreUint32(&o.done, 1) >> >> does not just take the address of o.done. It also executes the >> StoreUint32 function, which is defined by the sync/atomic >> documentation to behave like '*o.done = 1'; i.e., it alters the value >> of o.done. > > > Respectfully I disa

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Dave Cheney
On Friday, 29 December 2017 16:55:37 UTC+11, Caleb Spare wrote: > > > My argument is all that 'happens-before' is a comparison of o.done == > > 0 happens before the address of o.done is passed to > > atomic.StoreUint32. The rest is just luck. > > This expression: > > atomic.StoreUint32(&o.don

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Caleb Spare
> My argument is all that 'happens-before' is a comparison of o.done == > 0 happens before the address of o.done is passed to > atomic.StoreUint32. The rest is just luck. This expression: atomic.StoreUint32(&o.done, 1) does not just take the address of o.done. It also executes the StoreUint32 fu

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Dave Cheney
On Fri, Dec 29, 2017 at 3:52 PM, Caleb Spare wrote: > My argument is made without reference to registers, liveness, > inlining, or any of that. > > The memory model defines certain behavior of mutexes (intuitively, > it's how you think they would work) and sync/atomic defines how > StoreUint32 beh

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Caleb Spare
My argument is made without reference to registers, liveness, inlining, or any of that. The memory model defines certain behavior of mutexes (intuitively, it's how you think they would work) and sync/atomic defines how StoreUint32 behaves (it's some atomic version of *o.done = 1). (There are deta

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Dave Cheney
On Fri, Dec 29, 2017 at 2:16 PM, Caleb Spare wrote: > I'm quite certain that code is correct. There's no data race here > since the write and the non-atomic read are both inside the mutex. I don't believe so, I think this is currently safe because of the way the compiler does not maintain any liv

Re: [go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Caleb Spare
I'm quite certain that code is correct. There's no data race here since the write and the non-atomic read are both inside the mutex. The memory model rules about mutexes formalize how they serialize the code inside them. Because the unlock happens-before the next lock, and because sequential code

Re: [go-nuts] Where to stick temporary go files after an AST rewrite?

2017-12-28 Thread Matt Mueller
Oh that's brilliant, I didn't realize $GOPATH acted like $PATH. Haha, seems obvious when writing it out, but I thought it was just an environment variable. Thanks Matt! On Wednesday, December 27, 2017 at 10:40:21 AM UTC+7, Matt Harden wrote: > > You can put them anywhere on your GOPATH. So for e

Re: [go-nuts] O_DIRECT and write Array returns Invalid argument error

2017-12-28 Thread Ian Lance Taylor
On Thu, Dec 28, 2017 at 2:31 PM, Viacheslav Biriukov wrote: > > Could you please help me with the following code with O_DIRECT and array. I > tried to implement direct io and stuck with weird behaviour of alignment > writes created from array. > > > Following code doesn't work: > > > package main

[go-nuts] The o.done access on the once.Do function

2017-12-28 Thread Dave Cheney
I think you are right, all access to that field should go via atomic load/store operations. I don’t think it’s safe to mix those operations wth normal loads and stores even within the same goroutine. -- You received this message because you are subscribed to the Google Groups "golang-nuts" gr

[go-nuts] The o.done access on the once.Do function

2017-12-28 Thread yunhjiang
Hi, all, I have a question on the https://golang.org/src/sync/once.go, the Do() function. Hope I can get some guide. The current code will do "if o.done == 0 {" check after getting the lock. But how is it sure that the access to the o.done is from memory, instead of from registry? I che

[go-nuts] O_DIRECT and write Array returns Invalid argument error

2017-12-28 Thread Viacheslav Biriukov
Hello, Could you please help me with the following code with O_DIRECT and array. I tried to implement direct io and stuck with weird behaviour of alignment writes created from array. Following code doesn't work: package main import ( "os" "syscall" ) func main() { var p [2 <<

[go-nuts] Unsolicited response received on idle HTTP channel

2017-12-28 Thread wedneyyuri
Hi guys, I didn't find any docs about this behavior, but seems like it's related to a previous issue discussed in Google Chrome about the way that HAProxy handle timeouts

[go-nuts] Re: Go Community Charity Work?

2017-12-28 Thread Frank Davidson
I saw this which seems to say using a QR code is freely allowed: http://www.qrcode.com/en/faq.html On Thursday, December 28, 2017 at 11:19:27 AM UTC-5, matthe...@gmail.com wrote: > > Here's the aztec patent that's in the public domain: > http://www.adams1.com/patents/US5591956.pdf > > For QR it

[go-nuts] Re: Go Community Charity Work?

2017-12-28 Thread Frank Davidson
I was thinking https://github.com/boombuler/barcode for the creating of the QR or Aztec code and https://github.com/LazarSoft/jsqrcode for the decoding? I was assuming that JS would be best for decoding in a PSA website? But I'm totally open to other ideas! What do you think the specification

[go-nuts] Re: Go Community Charity Work?

2017-12-28 Thread Frank Davidson
I created this true quantum random number generator, perhaps excessive, for the random vector in the ECDSA algorithm. https://github.com/davidsonff/qrand Check it out and feel free to criticize! I'm sure it's overly paranoid, but I figure it's probably as truly random as can be... It falls back

[go-nuts] Re: Go Community Charity Work?

2017-12-28 Thread matthewjuran
Yes, but the godoc seems incomplete (https://godoc.org/github.com/boombuler/barcode/aztec) so I figured we could do a better job. Perhaps we only need encoding, but this lib doesn't provide decoding. Given the MIT license we could use it as an implementation source. The primary author doesn't p

[go-nuts] [ANN] reverse proxy with ssl in less than 100 lines of code

2017-12-28 Thread jzs
For those interested in hosting multiple golang apps on the same host without using nginx/apache/[insert reverse proxy here]. Shameless plug. I'm the author. But without golang.org/x/crypto/acme/autocert it wouldn't have been possible. https://journal.sketchground.dk/entry/2017-11-25-minimal-re

[go-nuts] Re: static analysis tool for detecting unclosed io.Closer's

2017-12-28 Thread Brian Sorahan
That seems like a decent affirmation! Thanks. On Wednesday, December 20, 2017 at 9:42:55 AM UTC-6, Howard C. Shaw III wrote: > > In the absence of an affirmative, I'll just say that I did a search of my > own. > > This site: > https://github.com/mre/awesome-static-analysis > lists a bunch of st

[go-nuts] Re: Go Community Charity Work?

2017-12-28 Thread Frank Davidson
Matt - You saw this library, correct? https://github.com/boombuler/barcode On Thursday, December 28, 2017 at 11:19:27 AM UTC-5, matthe...@gmail.com wrote: > > Here's the aztec patent that's in the public domain: > http://www.adams1.com/patents/US5591956.pdf > > For QR it seems that the "patent i

[go-nuts] Re: Go Community Charity Work?

2017-12-28 Thread matthewjuran
Here's the aztec patent that's in the public domain: http://www.adams1.com/patents/US5591956.pdf For QR it seems that the "patent is not exercised": https://stackoverflow.com/questions/3710937/what-is-the-spec-for-formatting-data-in-qr-codes-i-can-not-find-it-anywhere So I suggest we do use th