FAQ
that was needlessly obscure. sorry. http://play.golang.org/p/GEOslw9NyG
On Tuesday, April 9, 2013 12:59:44 AM UTC-7, Bryan Matsuo wrote:

There is no need to lock during the first length check (it's going to kill
performance). If the slice you check is longer than you need then the slice
you index (whether or not the same slice) long enough and cannot have been
garbage collected.

http://play.golang.org/p/lKvTPIVN3m
On Tuesday, April 9, 2013 12:21:36 AM UTC-7, kortschak wrote:

Good. Thanks - I was thinking about double checking but wasn't sure.

I just did a timing diagram for the promotion - yes, I see what you
mean.
On Tue, 2013-04-09 at 09:15 +0200, Rémy Oudompheng wrote:
It's not only baroque, it is not possible to promote because virtually
any code using that would deadlock immediately.

Having to check invariants twice is the normal pattern.

Some people have proposed wrappers that check the condition twice for
you but it didn't really simplify code.
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 16 of 20 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 9, '13 at 3:00a
activeApr 24, '13 at 3:54a
posts20
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase