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

Replace Sync impl with Clone impl #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

utkarshgupta137
Copy link

  • Replace Sync impl with Clone impl: Seemed like a copy paste error, so I've removed it
  • Only do ok check in Consumers when required: Couldn't find a reason that the check cannot happen later, so I've moved it inside the if block.
  • Replace Sync impl with Clone impl: This is a breaking change, but it makes this crate much more ergonomic as cloning is more simpler than using Arc<MPSCProducer> or a new type.
  • Currently we need to put the M part like MPSCProducer behind a shared reference like Arc, but it is internally already wrapping another Arc, so this change also removes the need for nested Arcs.
  • Also, for the S part like MPSCConsumer, we don't need to use the ok AtomicBool to know if the producer is still alive, we can just use Arc::strong_count to check that.
  • Arc::strong_count uses Relaxed load internally, so SCConsumer should be slightly faster in most cases.

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

Successfully merging this pull request may close these issues.

1 participant