Skip to content

Commit

Permalink
fixing HPX test bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Nov 15, 2019
1 parent 69b2ab2 commit 3907888
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ std::vector<std::string> 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;
}

Expand Down
11 changes: 9 additions & 2 deletions src/apex/policy_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace apex {
std::atomic<int> next_id(0);

#ifdef APEX_HAVE_HPX
std::atomic<bool> hpx_timer_stopped{false};
std::mutex hpx_timer_mutex;
policy_handler::policy_handler (void) : handler() { }
#else
policy_handler::policy_handler (void) : handler() { }
Expand Down Expand Up @@ -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<mutex> l(hpx_timer_mutex);
if (!hpx_timer_stopped) {
std::cout << "Stopping HPX timer" << std::endl;
hpx_timer.stop();
hpx_timer_stopped = true;
}
}
#endif
}
Expand Down

0 comments on commit 3907888

Please sign in to comment.