mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 04:51:47 +00:00
Eliminate extra thread for VfsWatcher
This commit is contained in:
parent
58b244b7e9
commit
f52f43fe90
2 changed files with 47 additions and 61 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::thread;
|
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use rand;
|
use rand;
|
||||||
|
|
@ -100,15 +99,8 @@ pub fn serve(project_path: &PathBuf, verbose: bool, port: Option<u64>) {
|
||||||
Arc::new(Mutex::new(vfs))
|
Arc::new(Mutex::new(vfs))
|
||||||
};
|
};
|
||||||
|
|
||||||
{
|
|
||||||
let vfs = vfs.clone();
|
|
||||||
|
|
||||||
thread::spawn(move || {
|
|
||||||
VfsWatcher::new(vfs).start();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("Server listening on port {}", web_config.port);
|
println!("Server listening on port {}", web_config.port);
|
||||||
|
|
||||||
|
VfsWatcher::new(vfs.clone()).start();
|
||||||
web::start(web_config, project.clone(), &PLUGIN_CHAIN, vfs.clone());
|
web::start(web_config, project.clone(), &PLUGIN_CHAIN, vfs.clone());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ impl VfsWatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(mut self) {
|
pub fn start(mut self) {
|
||||||
{
|
|
||||||
let outer_vfs = self.vfs.lock().unwrap();
|
let outer_vfs = self.vfs.lock().unwrap();
|
||||||
|
|
||||||
for (partition_name, root_path) in &outer_vfs.partitions {
|
for (partition_name, root_path) in &outer_vfs.partitions {
|
||||||
|
|
@ -85,9 +84,4 @@ impl VfsWatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
|
||||||
thread::park();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue