go-nsq icon indicating copy to clipboard operation
go-nsq copied to clipboard

document thread-safety

Open tj opened this issue 11 years ago • 2 comments

looks like the producer is but adding a quick node about thread safety properties would be sweet! safe some digging

cheers

tj avatar Jun 28 '14 18:06 tj

Yea, I think this is a good idea.

In my experience the convention is that if it's not explicitly stated as goroutine safe than the assumption is that it isn't.

I think in most cases library authors try to avoid assuming how you might want to synchronize your application and thus avoid bundling in those assumptions.

go-nsq might be in a bit different category though since it's pretty opinionated in how it should be used.

Out of curiosity, Which components/methods in particular were you questioning?

mreiferson avatar Jun 29 '14 12:06 mreiferson

Yeah that's the thing I'm finding with Go, people don't seem to document thread-safety so you're left digging around haha, I generally agree on delegating unless the granular locking is a big win then it probably makes sense to implement/document. I was just wondering about publishing in this case

tj avatar Jun 29 '14 17:06 tj