Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

ccond and TopicsProvider #23

Open
cloudzhou opened this issue Oct 20, 2015 · 2 comments
Open

ccond and TopicsProvider #23

cloudzhou opened this issue Oct 20, 2015 · 2 comments

Comments

@cloudzhou
Copy link

I hava some confusions, delete this issue if I make it wrong.
1 code: https://github.com/surgemq/surgemq/blob/master/service/buffer.go#L121-L123
is:
this.pcond.L.Lock()
this.ccond.Broadcast()
this.pcond.L.Unlock()
or just:
this.ccond.L.Lock()
this.ccond.Broadcast()
this.ccond.L.Unlock()
?
2 https://github.com/surgemq/surgemq/blob/master/topics/memtopics.go#L30-L48
why there are two same lines:
var _ TopicsProvider = (*memTopics)(nil)

Appreciate!

@zhenjl
Copy link
Contributor

zhenjl commented Oct 21, 2015

On buffer.go, I think what's there is correct. I need to look back and document the logic.

On memtopics.go, it's a dup line. Thanks for finding it. Though that line is really ignored during compilation. I will fix though.

@ankoh
Copy link

ankoh commented Jan 6, 2016

@cloudzhou Regarding your first question: The variable naming is a little bit demanding to be honest but pcond is the PRODUCER condition. So what the code correctly does is it gains exclusive PRODUCER access and then notifies the CONSUMERS about new data.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants