Open fosskers opened 5 months ago
For now, I have worked around this by tricking the compiler: https://github.com/fosskers/aura/blob/master/rust/r2d2-alpm/src/lib.rs#L35-L64
This works for my use cases. While indeed sharing a raw alpm::Alpm
across threads does currently cause segfaults, using a connection pool as I'm doing works as intended.
I did this like 3 years ago (been waiting to release V3 for a long time) so my memory is a bit fuzzy.
I think I'd need to re reason if it's safe or not. I think it may be safe if the callbacks were also bounded by send.
The error messages were complaining a lot about the callbacks, but also about the NonNull
that now wraps the inner alpm_handle_t
.
Experimentally at least it seems to be safe not explode. Using a pool I'm able to have several open Alpm connections and use them with rayon
, basically only for concurrent reads to the DB. I'm never calling anything requires &mut Alpm
.
For now Aura is fixed with the workaround, so there's no rush (on my end) for Send
to be provided directly.
Hi there. Between major versions 2 and 3, the
Alpm
type lost itsSend
implementation. This prevents it from being passed to other threads, even when wrapped in lock types like inArc<Mutex<Alpm>>
. Was this change intentional, or am I overlooking something?Thanks,
Colin