Commit 4908715e1814
tarball1 file changed+4-4
@@ -26,7 +26,7 @@ use std::sync::mpsc;
2626
const OFFLOAD_BYTES: i64 = 512 * 1024;2727
2828
pub struct Imports {29
- jobs: mpsc::Sender<Job>,29
+ jobs: Option<mpsc::Sender<Job>>,3030
worker: Option<std::thread::JoinHandle<()>>,3131
dmabufs: HashMap<WeakDmabuf, Waiters>,3232
shm: HashMap<ObjectId, Waiters>,@@ -56,7 +56,7 @@ impl Drop for Imports {
5656
// running, it destroys the device while NVIDIA's exit handlers tear down5757
// the same driver state on the main thread, and glibc aborts.5858
fn drop(&mut self) {59
- self.jobs = mpsc::channel().0;59
+ self.jobs = None;6060
if let Some(worker) = self.worker.take() {6161
let _ = worker.join();6262
}@@ -108,7 +108,7 @@ impl Imports {
108108
})109109
.map_err(|e| std::io::Error::other(e.to_string()))?;110110
Ok(Self {111
- jobs,111
+ jobs: Some(jobs),112112
worker: Some(worker),113113
dmabufs: HashMap::new(),114114
shm: HashMap::new(),@@ -126,7 +126,7 @@ impl Imports {
126126
}127127
128128
fn send(&self, job: Job) -> bool {129
- let sent = self.jobs.send(job).is_ok();129
+ let sent = self.jobs.as_ref().is_some_and(|j| j.send(job).is_ok());130130
if !sent {131131
tracing::warn!("buffer import worker is gone");132132
}