简体   繁体   中英

FFTW reentrancy in plug-in based programs

I'm developing a cross-platform application (Win / Mac / Linux). This application loads plug-ins that I don't control as dynamic libraries, which may do various things, mostly audio and image processing.

Some of these plug-ins may use FFTW as part of their implementation details. (This is not an hypothetical case - I already have three of those). But, FFTW's fftw_plan family of function is not reentrant per the docs - they can only be called by a single thread. The problem is that some of the plug-ins I could load may call fftw_plan deep inside some thread that they would create themselves.

Is there something I can do to still make sure that things work in that case, or should I just accept that this will end up crashing? (Putting each plug-in in its own process is not an acceptable solution for me sadly).

It turns out that FFTW provides the void fftw_make_planner_thread_safe(void) function which does ensure that plug-ins will be able to run plans in separate threads.

Calling it at the beginning of the program is enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM