AcademySoftwareFoundation / openexr

The OpenEXR project provides the specification and reference implementation of the EXR file format, the professional-grade image storage format of the motion picture industry.
http://www.openexr.com/
BSD 3-Clause "New" or "Revised" License
1.62k stars 614 forks source link

Can threading be turned off? #251

Open ashishUthama opened 6 years ago

ashishUthama commented 6 years ago

A documented option

/tmp/openexr/IlmBase> ./configure --help |\grep thread
  --enable-threading      enable multi-threading [[default=yes]]

doesnt seem to work:

/tmp/openexr/IlmBase> ./configure --enable_threading=no
configure: error: unrecognized option: `--enable_threading=no'
Try `./configure --help' for more information

I need to build with cmake (targetting glnxa64, maci and win64) so I was hoping to see how this option is implemented to try and replicate it on the cmake build.

Manually editing the configure script to set the default to 'No' results in compilation, but I dont know how that turns off threading - since OpenEXR still needs IlmThread.

meshula commented 6 years ago

That configuration is supposed to control the existence of the HAVE_PTHREAD macro on Posix systems. IlmThread will get built, but if you invoke the Ilm::Thread constructor it will throw. On Windows, this won't even happen.

Code that uses threading (DWA table lookups, test programs, and the viewer), should call IlmThread::supportsThreads();

It sounds like you need a configuration option that (1) forces that to return false, and (2) that opts in the stub-out files (such as IlmThread.cpp).

Sorry to say that doesn't exist at the moment; it doesn't look like a big change to actually support that via a new cmake option, since code is already guarded with supportThreads().

Hope this helps,

ashishUthama commented 6 years ago

Thanks for that bit of information and the pointer to supportsThreads, that helps.

yes, that sounds right (and actually, what I assumed the existing --enable-threading option did).

cary-ilm commented 5 years ago

Looking into the OpenEXR backlog. This is a reasonable feature request and deserves some further investigation about how to do it right.