From 39078882be65c6194b511862e03a390fb7a3c27f Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Thu, 14 Nov 2019 16:31:18 -0800 Subject: [PATCH] fixing HPX test bugs --- src/apex/apex.cpp | 2 +- src/apex/policy_handler.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/apex/apex.cpp b/src/apex/apex.cpp index 78b825bc..73906889 100644 --- a/src/apex/apex.cpp +++ b/src/apex/apex.cpp @@ -1730,7 +1730,7 @@ std::vector get_available_profiles() { void print_options() { // if APEX is disabled, do nothing. if (apex_options::disable() == true) { return; } - print_options(); + apex_options::print_options(); return; } diff --git a/src/apex/policy_handler.cpp b/src/apex/policy_handler.cpp index f81ac6eb..d0d9cd6a 100644 --- a/src/apex/policy_handler.cpp +++ b/src/apex/policy_handler.cpp @@ -33,6 +33,8 @@ namespace apex { std::atomic next_id(0); #ifdef APEX_HAVE_HPX + std::atomic hpx_timer_stopped{false}; + std::mutex hpx_timer_mutex; policy_handler::policy_handler (void) : handler() { } #else policy_handler::policy_handler (void) : handler() { } @@ -93,8 +95,13 @@ namespace apex { inline void policy_handler::_reset(void) { #ifdef APEX_HAVE_HPX if (_terminate) { - std::cout << "Stopping HPX timer" << std::endl; - hpx_timer.stop(); + // the timer can only be stopped once, by one thread. + std::unique_lock l(hpx_timer_mutex); + if (!hpx_timer_stopped) { + std::cout << "Stopping HPX timer" << std::endl; + hpx_timer.stop(); + hpx_timer_stopped = true; + } } #endif }