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

Add comment about thread-safety when OPENEXR_ENABLE_THREADING is disabled #1908

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmake/OpenEXRSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ set(IEX_NAMESPACE "Iex" CACHE STRING "Public namespace alias for Iex")
option(OPENEXR_INSTALL_PKG_CONFIG "Install OpenEXR.pc file" ON)

# Whether to enable threading. This can be disabled, although thread pool and tasks
# are still used, just processed immediately
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdt3rd, I think the existing comment although thread pool and tasks are still used is no longer true, right? Even if ENABLE_THREADING is ON, then no threadpool is created unless setGlobalThreadCount(n) is called with nonzero n, but OpenEXR will still be thread-safe. I think this what was originally wanted in #1902. ENABLE_THREADING should only be set to OFF on systems which do not support threading

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, it is still true technically, in that there is a "default" thread pool that has no threads running. And the writing classes will still add tasks to that threadpool until the next significant release even when threads == 0 (where when threads == 0, the reading classes don't incur that overhead. However yes, ENABLE_THREADING should be on for 99% of use cases, especially now that pthread and such are just part of libc on most systems, and only reserved for use on systems where no threading primitives are available, or threads are guaranteed to not be employed as it makes the library non-reentrant and non-threadsafe

# are still used, just processed immediately. Note that if this is disabled, the
# OpenEXR library may not be thread-safe and should only be used by a single thread.
option(OPENEXR_ENABLE_THREADING "Enables threaded processing of requests" ON)

option(OPENEXR_USE_DEFAULT_VISIBILITY "Makes the compile use default visibility (by default compiles tidy, hidden-by-default)" OFF)
Expand Down
Loading