Skip to content

Commit

Permalink
Making sure HPX_WITH_THREAD_BACKTRACE_ON_SUSPENSION compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jun 22, 2023
1 parent 4aa2e74 commit 3d8689d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,20 @@ jobs:
/hpx/source \
-G "Ninja" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_CLANG_TIDY=clang-tidy \
-DCMAKE_CXX_FLAGS="-fcolor-diagnostics" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DHPX_WITH_MALLOC=system \
-DHPX_WITH_FETCH_ASIO=Off \
-DHPX_WITH_DATAPAR_BACKEND=VC \
-DHPX_WITH_GIT_COMMIT=${CIRCLE_SHA1} \
-DHPX_WITH_GIT_BRANCH="${CIRCLE_BRANCH}" \
-DHPX_WITH_GIT_TAG="${CIRCLE_TAG}" \
-DHPX_WITH_TOOLS=On \
-DCMAKE_CXX_FLAGS="-fcolor-diagnostics" \
-DHPX_WITH_TESTS_HEADERS=On \
-DHPX_WITH_COMPILER_WARNINGS=On \
-DHPX_WITH_COMPILER_WARNINGS_AS_ERRORS=On \
-DHPX_WITH_DEPRECATION_WARNINGS=On \
-DCMAKE_CXX_CLANG_TIDY=clang-tidy \
-DHPX_WITH_THREAD_LOCAL_STORAGE=On \
-DHPX_WITH_STACKTRACES_STATIC_SYMBOLS=On \
-DHPX_WITH_STACKTRACES_DEMANGLE_SYMBOLS=Off \
-DHPX_WITH_TESTS_DEBUG_LOG=On \
Expand All @@ -246,9 +246,9 @@ jobs:
-DHPX_WITH_CHECK_MODULE_DEPENDENCIES=On \
-DHPX_LOGGING_WITH_SEPARATE_DESTINATIONS=Off \
-DHPX_WITH_THREAD_DEBUG_INFO=On \
-DHPX_WITH_THREAD_LOCAL_STORAGE=On \
-DHPX_COMMAND_LINE_HANDLING_WITH_JSON_CONFIGURATION_FILES=On \
-DHPX_WITH_FETCH_JSON=On \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DHPX_WITH_DOCUMENTATION=On \
-DHPX_WITH_DOCUMENTATION_OUTPUT_FORMATS="${DOCUMENTATION_OUTPUT_FORMATS}"
- persist_to_workspace:
Expand Down
3 changes: 3 additions & 0 deletions .jenkins/lsu/env-clang-14.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ configure_extra_options+=" -DHPX_WITH_FETCH_EVE=ON"
# Make sure HWLOC does not report 'cores'. This is purely an option to enable
# testing the topology code under conditions close to those on FreeBSD.
configure_extra_options+=" -DHPX_TOPOLOGY_WITH_ADDITIONAL_HWLOC_TESTING=ON"

configure_extra_options+=" -DHPX_WITH_THREAD_BACKTRACE_ON_SUSPENSION=ON"
configure_extra_options+=" -DHPX_WITH_THREAD_FULLBACKTRACE_ON_SUSPENSION=ON"
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

#ifdef HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION

#include <hpx/modules/debugging.hpp>
#include <hpx/modules/errors.hpp>
#include <hpx/threading_base/threading_base_fwd.hpp>

#include <memory>
#ifdef HPX_HAVE_THREAD_FULLBACKTRACE_ON_SUSPENSION
#include <string>
#endif

#include <hpx/config/warnings_prefix.hpp>

namespace hpx::threads::detail {

Expand All @@ -40,4 +43,6 @@ namespace hpx::threads::detail {
};
} // namespace hpx::threads::detail

#include <hpx/config/warnings_suffix.hpp>

#endif // HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ namespace hpx::threads {
spinlock_pool::spinlock_for(this));

std::string bt;
if (0 != backtrace_)
if (nullptr != backtrace_)
{
#ifdef HPX_HAVE_THREAD_FULLBACKTRACE_ON_SUSPENSION
bt = *backtrace_;
Expand Down
4 changes: 2 additions & 2 deletions libs/core/threading_base/src/detail/reset_backtrace.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022 Hartmut Kaiser
// Copyright (c) 2020-2023 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
Expand Down Expand Up @@ -36,7 +36,7 @@ namespace hpx::threads::detail {

reset_backtrace::~reset_backtrace()
{
threads::set_thread_backtrace(id_, 0, ec_);
threads::set_thread_backtrace(id_, nullptr, ec_);
}
} // namespace hpx::threads::detail

Expand Down
2 changes: 1 addition & 1 deletion libs/core/threading_base/src/execution_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ namespace hpx::threads {
id.noref(), threads::thread_description(desc));
#endif
#ifdef HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION
threads::detail::reset_backtrace bt(id);
threads::detail::reset_backtrace bt(id.noref());
#endif
[[maybe_unused]] on_exit_reset_held_lock_data held_locks;

Expand Down
14 changes: 8 additions & 6 deletions libs/core/threading_base/src/thread_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ namespace hpx::threads {
#endif

////////////////////////////////////////////////////////////////////////////
static thread_local std::size_t continuation_recursion_count(0);
namespace {
thread_local std::size_t continuation_recursion_count(0);
}

std::size_t& get_continuation_recursion_count() noexcept
{
Expand Down Expand Up @@ -438,7 +440,7 @@ namespace hpx::this_thread {
threads::thread_self& self = threads::get_self();

// keep alive
threads::thread_id_ref_type id = self.get_thread_id();
threads::thread_id_ref_type const id = self.get_thread_id();

// handle interruption, if needed
threads::interruption_point(id.noref(), ec);
Expand All @@ -448,16 +450,16 @@ namespace hpx::this_thread {
threads::thread_restart_state statex;

{
// verify that there are no more registered locks for this OS-thread
#ifdef HPX_HAVE_VERIFY_LOCKS
// verify that there are no more registered locks for this OS-thread
util::verify_no_locks();
#endif
#ifdef HPX_HAVE_THREAD_DESCRIPTION
threads::detail::reset_lco_description desc(
id.noref(), description, ec);
#endif
#ifdef HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION
threads::detail::reset_backtrace bt(id, ec);
threads::detail::reset_backtrace bt(id.noref(), ec);
#endif
// We might need to dispatch 'nextid' to it's correct scheduler only
// if our current scheduler is the same, we should yield to the id
Expand Down Expand Up @@ -509,7 +511,7 @@ namespace hpx::this_thread {
threads::thread_self& self = threads::get_self();

// keep alive
threads::thread_id_ref_type id = self.get_thread_id();
threads::thread_id_ref_type const id = self.get_thread_id();

// handle interruption, if needed
threads::interruption_point(id.noref(), ec);
Expand All @@ -529,7 +531,7 @@ namespace hpx::this_thread {
id.noref(), description, ec);
#endif
#ifdef HPX_HAVE_THREAD_BACKTRACE_ON_SUSPENSION
threads::detail::reset_backtrace bt(id, ec);
threads::detail::reset_backtrace bt(id.noref(), ec);
#endif
std::atomic<bool> timer_started(false);
threads::thread_id_ref_type const timer_id =
Expand Down

0 comments on commit 3d8689d

Please sign in to comment.