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

Does this count as single consumer? #34

Closed
svenoaks opened this issue Jun 26, 2016 · 1 comment
Closed

Does this count as single consumer? #34

svenoaks opened this issue Jun 26, 2016 · 1 comment
Labels

Comments

@svenoaks
Copy link

I have an operation which involves a single producer thread, and guaranteed only a single consumer thread accessing the queue concurrently. The rub is that the consumer could theoretically change pid numbers, ie be a different thread. Does this still count as SPSC or do I have to use the multiple thread version.

@cameron314
Copy link
Owner

That's a perfectly valid use of the queue, it still counts as single-consumer. However, you need to be careful to ensure that the memory effects from the first thread are fully seen by the second thread when the hand-off is made (i.e. make use of memory barriers (acquire-release) or a higher-level synchronization primitive like a mutex).

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

No branches or pull requests

2 participants