Skip to content

COMP: Let Future.get() calls in PoolMultiThreader always return void#5950

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
N-Dekker:PoolMultiThreader-Future-void
Mar 16, 2026
Merged

COMP: Let Future.get() calls in PoolMultiThreader always return void#5950
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
N-Dekker:PoolMultiThreader-Future-void

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

Future was declared as std::future<ITK_THREAD_RETURN_TYPE>, which is platform specific, and caused warnings on some platforms, as reported by Hans Johnson (@hjmjohnson) at #5945 :

itkPoolMultiThreader.cxx:148:55: warning:
  ignoring return value of function declared with 'nodiscard'
  attribute [-Wunused-result]
    exceptionHandler.TryAndCatch([this, threadLoop] { m_ThreadInfoArray[threadLoop].Future.get(); });
                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Addressed by using std::future<void> instead.

@github-actions github-actions bot added type:Compiler Compiler support or related warnings area:Core Issues affecting the Core module labels Mar 15, 2026
Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

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

Mostly looks good.

@N-Dekker N-Dekker force-pushed the PoolMultiThreader-Future-void branch from a22aedb to af0c4e3 Compare March 15, 2026 22:25
@N-Dekker N-Dekker marked this pull request as ready for review March 15, 2026 22:26
`Future` was declared as `std::future<ITK_THREAD_RETURN_TYPE>`, which is
platform specific, and caused warnings on some platforms, as reported by Hans
Johnson at InsightSoftwareConsortium#5945 :

    itkPoolMultiThreader.cxx:148:55: warning:
      ignoring return value of function declared with 'nodiscard'
      attribute [-Wunused-result]
        exceptionHandler.TryAndCatch([this, threadLoop] { m_ThreadInfoArray[threadLoop].Future.get(); });
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Addressed by replacing the public `ThreadPoolInfoStruct` with a private
`InternalWorkUnitInfo` struct, which has its `Future` declared as
`std::future<void>`.
@N-Dekker N-Dekker force-pushed the PoolMultiThreader-Future-void branch from af0c4e3 to fd7c78b Compare March 15, 2026 22:39
@hjmjohnson
Copy link
Copy Markdown
Member

ARM build failures are un-related and resolved in

@hjmjohnson hjmjohnson merged commit 912328d into InsightSoftwareConsortium:main Mar 16, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants