Closed bluskript closed 3 years ago
Looks good to me. The thing is though this will allow you to send alpm to another thread but it won't really help with concurruncy.
I'll merge either way because there's no reason it shouldn't be send. But if you want concurrency more will need to be done.
What do you mean by 'it won't really help with concurrency'? Wouldn't making it Send make it possible to use alpm inside tasks? For example:
pub fn begin_proc_monitor(&self) -> Result<(), Box<dyn std::error::Error>> {
tokio::spawn(async move {
println!("{:?}", self.alpm);
});
Ok(());
}
Yes you could totally do that. This will let you do something and alpm stuff concurrency. But I if you want to do multiple alpm stuff concurrent you can't.
Sync however is not safe at at. Alpm has inner multamiluty like RefCell. So relies on not being sync.
Note: I've only used Rust for a few days, so this might not make Alpm be Send.