Fully halt background scanner threads when dropping Worktree

* Rework fsevent API to expose a handle for halting the event stream

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-04-20 15:55:29 -07:00
co-authored by Nathan Sobo
parent 9fd8acdce7
commit b20f5e9139
6 changed files with 158 additions and 68 deletions
+2 -2
View File
@@ -21,11 +21,11 @@ struct Request {
}
impl Pool {
pub fn new(thread_count: usize, name: &str) -> Self {
pub fn new(thread_count: usize, name: impl AsRef<str>) -> Self {
let (req_tx, req_rx) = chan::unbounded();
for i in 0..thread_count {
thread::Builder::new()
.name(format!("scoped_pool {} {}", name, i))
.name(format!("scoped_pool {} {}", name.as_ref(), i))
.spawn({
let req_rx = req_rx.clone();
move || loop {