Skip to content
Myr

Merge pull request #916 from tavianator/revert-crossbeam

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

Revert "Switch from std::sync::mpsc to crossbeam-channel"

authored by David Peter · committed by GitHub · parents aa1c025, aa6933d · Browse files · 4 files+8 added−17 removed
This commit

State

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

Diff stats

4 files+8 added−17 removed

  • other:+8 added−17 removed

4 files+8 added−17 removed

modified:src/exec/job.rs+1 added-2 removed
1use std::path::PathBuf;2use std::sync::mpsc::Receiver;3use std::sync::{Arc, Mutex};44use crossbeam_channel::Receiver;55use crate::error::print_error;6use crate::exit_codes::{merge_exitcodes, ExitCode};7use crate::walk::WorkerResult;8
69 unmodified lines
modified:src/walk.rs+7 added-3 removed
2 unmodified lines
3use std::io;4use std::mem;5use std::path::{Path, PathBuf};6use std::sync::atomic::{AtomicBool, Ordering};7use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender};8use std::sync::{Arc, Mutex};9use std::thread;10use std::time::{Duration, Instant};11use std::{borrow::Cow, io::Write};1213use anyhow::{anyhow, Result};13use crossbeam_channel::{unbounded, Receiver, RecvTimeoutError, Sender};14use ignore::overrides::OverrideBuilder;15use ignore::{self, WalkBuilder};16use once_cell::unsync::OnceCell;17use regex::bytes::Regex;
36 unmodified lines
54 let mut path_iter = path_vec.iter();55 let first_path_buf = path_iter56 .next()57 .expect("Error: Path vector can not be empty");58 let (tx, rx) = unbounded();58 let (tx, rx) = channel();5960 let mut override_builder = OverrideBuilder::new(first_path_buf.as_path());6162 for pattern in &config.exclude_patterns {
168 unmodified lines
231 fn recv(&self) -> Result<WorkerResult, RecvTimeoutError> {232 match self.mode {233 ReceiverMode::Buffering => {234 // Wait at most until we should switch to streaming235 self.rx.recv_deadline(self.deadline)235 let now = Instant::now();236 self.deadline237 .checked_duration_since(now)238 .ok_or(RecvTimeoutError::Timeout)239 .and_then(|t| self.rx.recv_timeout(t))240 }241 ReceiverMode::Streaming => {242 // Wait however long it takes for a result243 Ok(self.rx.recv()?)
388 unmodified lines
modified:Cargo.lock-11 removed
98 unmodified lines
99 "vec_map",100]101102[[package]]103name = "crossbeam-channel"104version = "0.5.1"105source = "registry+https://github.com/rust-lang/crates.io-index"106checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"107dependencies = [108 "cfg-if",109 "crossbeam-utils",110]111112[[package]]103name = "crossbeam-utils"104version = "0.8.5"105source = "registry+https://github.com/rust-lang/crates.io-index"106checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
47 unmodified lines
154 "anyhow",155 "atty",156 "chrono",157 "clap",168 "crossbeam-channel",158 "ctrlc",159 "diff",160 "dirs-next",161 "filetime",
497 unmodified lines
modified:Cargo.toml-1 removed