Skip to content
Myr

Use non-sync channel

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

authored by David Peter · committed by David Peter · parent e990a13 · Browse files · 1 file+2 added−8 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+2 added−8 removed

  • other:+2 added−8 removed

1 file+2 added−8 removed

modified:src/walk.rs+2 added-8 removed
1 unmodified line
2use std::fs::{FileType, Metadata};3use std::io;4use std::path::{Path, PathBuf};5use std::sync::atomic::{AtomicBool, Ordering};6use std::sync::mpsc::{sync_channel, Receiver, SyncSender as Sender};6use std::sync::mpsc::{channel, Receiver, Sender};7use std::sync::{Arc, Mutex};8use std::thread;9use std::time;10use std::{borrow::Cow, io::Write};
10 unmodified lines
21use crate::exit_codes::{merge_exitcodes, ExitCode};22use crate::filesystem;23use crate::output;2425pub const WORKER_CHANNEL_DEFAULT_BOUND: usize = 1000;2627pub fn make_worker_channel() -> (Sender<WorkerResult>, Receiver<WorkerResult>) {28 sync_channel(WORKER_CHANNEL_DEFAULT_BOUND)29}3025/// The receiver thread can either be buffering results or directly streaming to the console.26enum ReceiverMode {27 /// Receiver is still buffering in order to sort the results, if the search finishes fast28 /// enough.
23 unmodified lines
52 let mut path_iter = path_vec.iter();53 let first_path_buf = path_iter54 .next()55 .expect("Error: Path vector can not be empty");62 let (tx, rx) = make_worker_channel();56 let (tx, rx) = channel();5758 let mut override_builder = OverrideBuilder::new(first_path_buf.as_path());5960 for pattern in &config.exclude_patterns {
469 unmodified lines