Patchwork [1,of,2] rust: fix false comment about mpsc::Sender

login
register
mail settings
Submitter Yuya Nishihara
Date May 25, 2020, 2:27 p.m.
Message ID <261fbbdabb261a44c0f8.1590416860@mimosa>
Download mbox | patch
Permalink /patch/46371/
State Accepted
Headers show

Comments

Yuya Nishihara - May 25, 2020, 2:27 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1590415327 -32400
#      Mon May 25 23:02:07 2020 +0900
# Node ID 261fbbdabb261a44c0f82537f10abbcc0d85ace1
# Parent  f3b69aecfdc3f6149a30f87bba43396890c2bee7
rust: fix false comment about mpsc::Sender

We need Sync to share the Sender reference across threads.
Raphaël Gomès - May 25, 2020, 2:37 p.m.
Good catch, patch 2 also looks good, thanks.

On 5/25/20 4:27 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1590415327 -32400
> #      Mon May 25 23:02:07 2020 +0900
> # Node ID 261fbbdabb261a44c0f82537f10abbcc0d85ace1
> # Parent  f3b69aecfdc3f6149a30f87bba43396890c2bee7
> rust: fix false comment about mpsc::Sender
>
> We need Sync to share the Sender reference across threads.
>
> diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs
> --- a/rust/hg-core/src/dirstate/status.rs
> +++ b/rust/hg-core/src/dirstate/status.rs
> @@ -560,7 +560,7 @@ fn traverse<'a>(
>       let root_dir = root_dir.as_ref();
>   
>       // The traversal is done in parallel, so use a channel to gather entries.
> -    // `crossbeam::Sender` is `Send`, while `mpsc::Sender` is not.
> +    // `crossbeam::Sender` is `Sync`, while `mpsc::Sender` is not.
>       let (files_transmitter, files_receiver) = crossbeam::channel::unbounded();
>   
>       traverse_dir(
> @@ -877,7 +877,7 @@ pub fn status<'a: 'c, 'b: 'c, 'c>(
>   
>       let files = matcher.file_set();
>   
> -    // `crossbeam::Sender` is `Send`, while `mpsc::Sender` is not.
> +    // `crossbeam::Sender` is `Sync`, while `mpsc::Sender` is not.
>       let (traversed_sender, traversed_recv) = crossbeam::channel::unbounded();
>   
>       // Step 1: check the files explicitly mentioned by the user
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -560,7 +560,7 @@  fn traverse<'a>(
     let root_dir = root_dir.as_ref();
 
     // The traversal is done in parallel, so use a channel to gather entries.
-    // `crossbeam::Sender` is `Send`, while `mpsc::Sender` is not.
+    // `crossbeam::Sender` is `Sync`, while `mpsc::Sender` is not.
     let (files_transmitter, files_receiver) = crossbeam::channel::unbounded();
 
     traverse_dir(
@@ -877,7 +877,7 @@  pub fn status<'a: 'c, 'b: 'c, 'c>(
 
     let files = matcher.file_set();
 
-    // `crossbeam::Sender` is `Send`, while `mpsc::Sender` is not.
+    // `crossbeam::Sender` is `Sync`, while `mpsc::Sender` is not.
     let (traversed_sender, traversed_recv) = crossbeam::channel::unbounded();
 
     // Step 1: check the files explicitly mentioned by the user