diff --git a/src/madness/world/parsec.cc b/src/madness/world/parsec.cc index 555c822c586..2e4c7f94f4e 100644 --- a/src/madness/world/parsec.cc +++ b/src/madness/world/parsec.cc @@ -226,13 +226,13 @@ namespace madness { if (*made_new_ctx) { parsec_context_wait(ctx); parsec_fini(&ctx); - if (nullptr != madness_comm_thread_es) { + ctx = nullptr; + } + if (nullptr != madness_comm_thread_es) { /* madness_comm_thread_es is just a copy of ES[0]. Resources (including es->profiling_es) are * actually freed during parsec_fini. Just need to free memory allocated to store it. */ free(madness_comm_thread_es); madness_comm_thread_es = nullptr; - } - ctx = nullptr; } } diff --git a/src/madness/world/thread.h b/src/madness/world/thread.h index 836f20562db..eb15cb4b825 100644 --- a/src/madness/world/thread.h +++ b/src/madness/world/thread.h @@ -1122,7 +1122,12 @@ namespace madness { void operator=(const ThreadPool&) = delete; void operator=(ThreadPool&&) = delete; - private: + /// Get the number of threads from the environment. + + /// \return The number of threads. + static int default_nthread(); + + private: friend class WorldTaskQueue; // Thread pool data @@ -1147,11 +1152,6 @@ namespace madness { /// \param[in] nthread Description needed. ThreadPool(int nthread=-1); - /// Get the number of threads from the environment. - - /// \return The number of threads. - int default_nthread(); - /// Run the next task. /// \todo Verify and complete this documentation.