diff options
| author | bors <bors@rust-lang.org> | 2020-05-25 02:48:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-25 02:48:55 +0000 |
| commit | 2679c38fc33b5f69ce3c502c81315aa889035191 (patch) | |
| tree | 8d63ea9cbb21736b8bde3fc855d388994821e398 /src/libstd/sys | |
| parent | 62da38d00d8d09dbaaa092c7b5e7ea343fdc2126 (diff) | |
| parent | 01630b26ddcf647a6e87a0d6a18055a7c516cdbc (diff) | |
| download | rust-2679c38fc33b5f69ce3c502c81315aa889035191.tar.gz rust-2679c38fc33b5f69ce3c502c81315aa889035191.zip | |
Auto merge of #72472 - LeSeulArtichaut:sync-command, r=dtolnay
Implement `Sync` for `process::Command on unix and vxworks Closes #72387. r? @cuviper
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/process/process_common.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sys/vxworks/process/process_common.rs | 6 |
2 files changed, 8 insertions, 4 deletions
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 |
