Skip to content
Myr

Workaround for the `unsafe` block.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

See #147

authored by sharkdp · committed by David Peter · parent 7b8d932 · Browse files · 1 file+6 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:src/walk.rs+6 added-4 removed
4 unmodified lines
5// at your option. All files in the project carrying such6// notice may not be copied, modified, or distributed except7// according to those terms.89use exec::{self, TokenizedCommand};9use exec;10use fshelper;11use internal::{error, FdOptions};12use output;13
68 unmodified lines
82 let shared_rx = Arc::new(Mutex::new(rx));8384 let out_perm = Arc::new(Mutex::new(()));8586 // This is safe because `cmd` will exist beyond the end of this scope.87 // It's required to tell Rust that it's safe to share across threads.88 let cmd = unsafe { Arc::from_raw(cmd as *const TokenizedCommand) };86 // TODO: the following line is a workaround to replace the `unsafe` block that was87 // previously used here to avoid the (unnecessary?) cloning of the command. The88 // `unsafe` block caused problems on some platforms (SIGILL instructions on Linux) and89 // therefore had to be removed.90 let cmd = Arc::new(cmd.clone());9192 // Each spawned job will store it's thread handle in here.93 let mut handles = Vec::with_capacity(threads);94 for _ in 0..threads {
138 unmodified lines