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

Deprecate the new_thread() functions. #13116

Merged
merged 2 commits into from
Dec 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/news/changes/minor/20211223Bangerth
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Deprecated: The Threads::new_thread() functions have been
deprecated. These functions return a Threads::Thread object, which is
a class that had previously been deprecated, and should no longer be
used: use the `std::thread` or `std::jthread` classes and related
functionality instead.
<br>
(Wolfgang Bangerth, 2021/12/23)
20 changes: 15 additions & 5 deletions include/deal.II/base/thread_management.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,12 @@ namespace Threads
* function object without arguments and returning an object of type RT (or
* void).
*
* @deprecated Use std::thread or std::jthread instead.
*
* @ingroup threads
*/
template <typename RT>
inline Thread<RT>
DEAL_II_DEPRECATED inline Thread<RT>
new_thread(const std::function<RT()> &function)
{
return Thread<RT>(function);
Expand Down Expand Up @@ -826,10 +828,12 @@ namespace Threads
* or capture have a lifetime that extends at least until the time
* where the thread finishes.
*
* @deprecated Use std::thread or std::jthread instead.
*
* @ingroup CPP11
*/
template <typename FunctionObjectType>
inline auto
DEAL_II_DEPRECATED inline auto
new_thread(FunctionObjectType function_object)
-> Thread<decltype(function_object())>
{
Expand All @@ -843,10 +847,12 @@ namespace Threads
* Overload of the new_thread function for non-member or static member
* functions.
*
* @deprecated Use std::thread or std::jthread instead.
*
* @ingroup threads
*/
template <typename RT, typename... Args>
inline Thread<RT>
DEAL_II_DEPRECATED inline Thread<RT>
new_thread(RT (*fun_ptr)(Args...), typename identity<Args>::type... args)
{
auto dummy = std::make_tuple(internal::maybe_make_ref<Args>::act(args)...);
Expand All @@ -859,10 +865,12 @@ namespace Threads
/**
* Overload of the non-const new_thread function for member functions.
*
* @deprecated Use std::thread or std::jthread instead.
*
* @ingroup threads
*/
template <typename RT, typename C, typename... Args>
inline Thread<RT>
DEAL_II_DEPRECATED inline Thread<RT>
new_thread(RT (C::*fun_ptr)(Args...),
typename identity<C>::type &c,
typename identity<Args>::type... args)
Expand All @@ -875,10 +883,12 @@ namespace Threads
/**
* Overload of the new_thread function for const member functions.
*
* @deprecated Use std::thread or std::jthread instead.
*
* @ingroup threads
*/
template <typename RT, typename C, typename... Args>
inline Thread<RT>
DEAL_II_DEPRECATED inline Thread<RT>
new_thread(RT (C::*fun_ptr)(Args...) const,
typename identity<const C>::type &c,
typename identity<Args>::type... args)
Expand Down