georust / netcdf

High-level netCDF bindings for Rust
Apache License 2.0
81 stars 28 forks source link

Regarding thread safety #128

Open krestomantsi opened 6 months ago

krestomantsi commented 6 months ago

Can someone clarify whether the thread safety corresponds to reading the same file in parallel or multiple reads from different files? Also can the read me please be updated? I did not know how to contact the organisation so I made an issue instead. I apologize if this was wrong.

magnusuMET commented 6 months ago

Thread safety is taken care of when using the netcdf crate. You only have to worry about this when using netcdf-sys

lnicola commented 6 months ago

Note that libnetcdf's approach to threading seems to be "everything takes a global lock" (and I've seen it crash when opening unrelated files on different threads, probably someone forgot to take that lock).

You can use threads with this crate, but don't expect an increase in throughput.