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

inprocess: Don't wrap OsIpcReceiver to make it Sync #107

Merged
merged 1 commit into from
Oct 4, 2016

Conversation

antrik
Copy link
Contributor

@antrik antrik commented Oct 4, 2016

Wrap the inprocess receiver in a simple RefCell<> instead of
Arc<Mutex<>> (again).

Adding the mutex here is not a good idea: it only adds overhead and
potential errors, since not all of the other backends have a Sync
receiver either; nor does the mpsc mechanism ipc-channel is modelled
after. In fact it fundamentally violates the "single receiver" aspect of
mpsc, as outlined in
#89 (comment)

Users can still wrap it explicitly if they need to, and know it doesn't
introduce incorrect behaviour in the specific use case.

This change mostly reverts the Receiver part of
30b2024 ; it doesn't re-introduce the
explicit Sync declaration for Receiver though, as that was/is
clearly not true without the Mutex -- nor really desirable, as explained
above. This change also doesn't touch the Sender part, which is a
different story.

Wrap the inprocess receiver in a simple `RefCell<>` instead of
`Arc<Mutex<>>` (again).

Adding the mutex here is not a good idea: it only adds overhead and
potential errors, since not all of the other backends have a `Sync`
receiver either; nor does the `mpsc` mechanism `ipc-channel` is modelled
after. In fact it fundamentally violates the "single receiver" aspect of
`mpsc`, as outlined in
servo#89 (comment)

Users can still wrap it explicitly if they need to, and know it doesn't
introduce incorrect behaviour in the specific use case.

This change mostly reverts the `Receiver` part of
30b2024 ; it doesn't re-introduce the
explicit `Sync` declaration for `Receiver` though, as that was/is
clearly not true without the Mutex -- nor really desirable, as explained
above. This change also doesn't touch the `Sender` part, which is a
different story.
@jdm
Copy link
Member

jdm commented Oct 4, 2016

@bors-servo: r+
Thanks for cleaning this up!

@bors-servo
Copy link
Contributor

📌 Commit 77469c2 has been approved by jdm

bors-servo pushed a commit that referenced this pull request Oct 4, 2016
inprocess: Don't wrap `OsIpcReceiver` to make it `Sync`

Wrap the inprocess receiver in a simple `RefCell<>` instead of
`Arc<Mutex<>>` (again).

Adding the mutex here is not a good idea: it only adds overhead and
potential errors, since not all of the other backends have a `Sync`
receiver either; nor does the `mpsc` mechanism `ipc-channel` is modelled
after. In fact it fundamentally violates the "single receiver" aspect of
`mpsc`, as outlined in
#89 (comment)

Users can still wrap it explicitly if they need to, and know it doesn't
introduce incorrect behaviour in the specific use case.

This change mostly reverts the `Receiver` part of
30b2024 ; it doesn't re-introduce the
explicit `Sync` declaration for `Receiver` though, as that was/is
clearly not true without the Mutex -- nor really desirable, as explained
above. This change also doesn't touch the `Sender` part, which is a
different story.
@bors-servo
Copy link
Contributor

⌛ Testing commit 77469c2 with merge 2f806ce...

@bors-servo
Copy link
Contributor

☀️ Test successful - status-appveyor, status-travis

@bors-servo bors-servo merged commit 77469c2 into servo:master Oct 4, 2016
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.

3 participants