rust-math / fftw

FFTW3 binding for Rust
Other
57 stars 27 forks source link

Can plan executions take &self instead of &mut self? #115

Open dodomorandi opened 3 years ago

dodomorandi commented 3 years ago

I am asking this, because I am having a hard time trying to check whether this is possible or not. According to this documentation, execution of plans should take a const pointer to the plan (which AFAIK is nearly meaningless in the C world, because you are totally safe (ahem) to change nested values...).

Maybe it could be possible, but I am completely unable to hack through the code of FFTW3 to find the answer by myself. I could not find a similar question, therefore, even if c2c/r2c/c2r really need to use &mut self, at least there is an issue explicitly discussing this.

miili commented 3 years ago

Yes this should definitely work!

miili commented 3 years ago

Implemented in https://github.com/rust-math/fftw/pull/117

skailasa commented 1 year ago

I'm attempting to do this, but getting the error that,

| |_________^ `*mut fftw_sys::fftw_plan_s` cannot be shared between threads safely

As plans don't implement Sync, required by rayon's parallel iterator

Edit, Oh I see it hasn't been merged into master, are there any plans to do this?

miili commented 1 year ago

I'd hope! The repo unfortunately looks unmaintained...