about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeSeulArtichaut <leseulartichaut@gmail.com>2020-05-22 18:30:26 +0200
committerLeSeulArtichaut <leseulartichaut@gmail.com>2020-05-22 18:33:12 +0200
commit01630b26ddcf647a6e87a0d6a18055a7c516cdbc (patch)
treebfe8d5860629beab0a9e39a7987b038eaa47b068
parenta9ca1ec9280ca1e5020edd699917c3367a30a798 (diff)
downloadrust-01630b26ddcf647a6e87a0d6a18055a7c516cdbc.tar.gz
rust-01630b26ddcf647a6e87a0d6a18055a7c516cdbc.zip
Implement `Sync` for `process::Command on unix and vxworks
-rw-r--r--src/libstd/process.rs6
-rw-r--r--src/libstd/sys/unix/process/process_common.rs6
-rw-r--r--src/libstd/sys/vxworks/process/process_common.rs6
3 files changed, 11 insertions, 7 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index f7e7a5abf8e..4ba1940fd0e 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -2105,8 +2105,8 @@ mod tests {
     }
 
     #[test]
-    fn test_command_implements_send() {
-        fn take_send_type<T: Send>(_: T) {}
-        take_send_type(Command::new(""))
+    fn test_command_implements_send_sync() {
+        fn take_send_sync_type<T: Send + Sync>(_: T) {}
+        take_send_sync_type(Command::new(""))
     }
 }
diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs
index 859da691ad2..2d7267263de 100644
--- a/src/libstd/sys/unix/process/process_common.rs
+++ b/src/libstd/sys/unix/process/process_common.rs
@@ -86,11 +86,13 @@ pub struct Command {
     stderr: Option<Stdio>,
 }
 
-// Create a new type for argv, so that we can make it `Send`
+// Create a new type for argv, so that we can make it `Send` and `Sync`
 struct Argv(Vec<*const c_char>);
 
-// It is safe to make Argv Send, because it contains pointers to memory owned by `Command.args`
+// It is safe to make `Argv` `Send` and `Sync`, because it contains
+// pointers to memory owned by `Command.args`
 unsafe impl Send for Argv {}
+unsafe impl Sync for Argv {}
 
 // passed back to std::process with the pipes connected to the child, if any
 // were requested
diff --git a/src/libstd/sys/vxworks/process/process_common.rs b/src/libstd/sys/vxworks/process/process_common.rs
index 6d5506bec5f..78b6e9a4db7 100644
--- a/src/libstd/sys/vxworks/process/process_common.rs
+++ b/src/libstd/sys/vxworks/process/process_common.rs
@@ -49,11 +49,13 @@ pub struct Command {
     stderr: Option<Stdio>,
 }
 
-// Create a new type for argv, so that we can make it `Send`
+// Create a new type for `Argv`, so that we can make it `Send` and `Sync`
 struct Argv(Vec<*const c_char>);
 
-// It is safe to make Argv Send, because it contains pointers to memory owned by `Command.args`
+// It is safe to make `Argv` `Send` and `Sync`, because it contains
+// pointers to memory owned by `Command.args`
 unsafe impl Send for Argv {}
+unsafe impl Sync for Argv {}
 
 // passed back to std::process with the pipes connected to the child, if any
 // were requested