Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot share dataset safely between threads #522

Closed
arya-pathak opened this issue Feb 22, 2024 · 2 comments
Closed

Cannot share dataset safely between threads #522

arya-pathak opened this issue Feb 22, 2024 · 2 comments

Comments

@arya-pathak
Copy link

On trying to share the dataset object between multiple rayon threads for read/write operations, I get the following error:
`*mut c_void` cannot be shared between threads safely within `{closure@src/lib.rs:218:19: 218:34}`, the trait `Sync` is not implemented for `*mut c_void` required because it appears within the type `&Dataset`

Using an Arc pointer along with a mutex introduces a lot of overhead and sometimes even slows down compared to the serial implementation.
Is there any support for sharing a dataset between multiple threads safely?

cc: @rkshthrmsh

@lnicola
Copy link
Member

lnicola commented Feb 22, 2024

GDAL doesn't support that: https://gdal.org/user/multithreading.html, see also #425.

@lnicola lnicola closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2024
@ManeraKai
Copy link

ManeraKai commented Apr 28, 2024

GDAL isn't thread-safe, but it is re-entrant. So, this ranyon code should be allowed:

  let test: Vec<Geometry> = (0..10)
        .into_par_iter()
        .map(|_| Geometry::from_wkt("POINT (10, 10)").unwrap())
        .collect();

right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants