Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: Package sync should have examples #5741

Closed
gopherbot opened this issue Jun 20, 2013 · 14 comments
Closed

sync: Package sync should have examples #5741

gopherbot opened this issue Jun 20, 2013 · 14 comments

Comments

@gopherbot
Copy link

by aaron.l.france:

The sync package documentation would be greatly improved if each type (Mutex/RWMutex
etc) had a section for an example. To some people an RWMutex is quite foreign.

-Aaron
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added priority-later, documentation, removed priority-triage.

Owner changed to @dvyukov.

@adg
Copy link
Contributor

adg commented Jun 21, 2013

Comment 2:

It should have _more_ examples: http://golang.org/pkg/sync/#pkg-examples

@gopherbot
Copy link
Author

Comment 3 by aaron.l.france:

Sorry, yes. More.

@fatih
Copy link
Member

fatih commented Jun 21, 2013

Comment 4:

I was the one who asked this on IRC too. I was confused because google didn't return any
page for "mutex" vs "rwmutex". And the documentation didn't have any example. Aaron did
help with a trivial example and than It was really easy to understand it

@dvyukov
Copy link
Member

dvyukov commented Jun 21, 2013

Comment 5:

FTR:
https://groups.google.com/forum/#!search/"Examples$20for$20sync$20package"/golang-dev/LHmIq7mJ5ZY/45kytJmiXUgJ
There also were this lost response from Russ:
------
It would be good to have examples for WaitGroup and Once.
I think Mutex and RWMutex probably don't need examples,
and Cond is low level enough that I'd rather not encourage
use of it.

@gopherbot
Copy link
Author

Comment 6 by aaron.l.france:

I vehemently disagree with them not needing examples. If required I can
post some examples up myself, for review.

@robpike
Copy link
Contributor

robpike commented Jun 21, 2013

Comment 7:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 8:

Labels changed: added go1.2.

@dvyukov
Copy link
Member

dvyukov commented Aug 19, 2013

Comment 9:

Owner changed to @adg.

@adg
Copy link
Contributor

adg commented Aug 21, 2013

Comment 10:

Dmitry says (and I agree) that "People who already know what the mutex is do not need
the example."
But let's go further—people who don't know what the mutex is do not need a mutex.

Status changed to WontFix.

@fatih
Copy link
Member

fatih commented Aug 21, 2013

Comment 11:

The problem is, the example is not needed for understanding mutex. It is needed for
understanding the difference between RWMutex and Mutex. The doc's are not clear on that.
I hope you consider that.

@adg
Copy link
Contributor

adg commented Aug 21, 2013

Comment 12:

I have given the matter a lot of considered thought. Using these primitives correctly is
not something that can be learned by reading a couple of examples in the standard
library.

@cznic
Copy link
Contributor

cznic commented Aug 21, 2013

@gopherbot
Copy link
Author

Comment 14 by aaron.l.france:

Perhaps I should have been clearer. My reasoning for asking for docs was
that for newbies to the language (and concurrent languages in general) then
a Mutex and an RWMutex is going to be something which requires an
explanation of the differences.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned adg Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants