Skip to content

Commit

Permalink
Fix #667: Not reading ini file properly
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jan 17, 2013
1 parent 5014f9c commit 6e336b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
4 changes: 3 additions & 1 deletion hpx/util/runtime_configuration.hpp
Expand Up @@ -114,13 +114,15 @@ namespace hpx { namespace util
std::ptrdiff_t init_huge_stack_size() const;

#if defined(__linux) || defined(linux) || defined(__linux__)
void init_use_stack_guard_pages() const;
bool init_use_stack_guard_pages() const;
#endif

void pre_initialize_ini();
void post_initialize_ini(std::string const& hpx_ini_file,
std::vector<std::string> const& cmdline_ini_defs);

void reconfigure();

private:
std::ptrdiff_t small_stacksize;
std::ptrdiff_t medium_stacksize;
Expand Down
42 changes: 13 additions & 29 deletions src/util/runtime_configuration.cpp
Expand Up @@ -243,6 +243,9 @@ namespace hpx { namespace util
util::merge_component_inis(*this);

need_to_call_pre_initialize = true;

// invoke last reconfigure
reconfigure();
}

///////////////////////////////////////////////////////////////////////////
Expand All @@ -268,7 +271,7 @@ namespace hpx { namespace util
huge_stacksize = init_huge_stack_size();

#if defined(__linux) || defined(linux) || defined(__linux__)
init_use_stack_guard_pages();
coroutines::detail::posix::use_guard_pages = init_use_stack_guard_pages();
#endif
}

Expand All @@ -277,37 +280,18 @@ namespace hpx { namespace util
std::string const& hpx_ini_file_)
{
hpx_ini_file = hpx_ini_file_;

pre_initialize_ini();

std::vector<std::string> const& prefill =
util::detail::get_logging_data();
if (!prefill.empty())
this->parse("static prefill defaults", prefill, false);

post_initialize_ini(hpx_ini_file, cmdline_ini_defs);

// set global config options
#if HPX_USE_ITTNOTIFY != 0
use_ittnotify_api = get_itt_notify_mode();
#endif
BOOST_ASSERT(init_small_stack_size() >= HPX_SMALL_STACK_SIZE);

small_stacksize = init_small_stack_size();
medium_stacksize = init_medium_stack_size();
large_stacksize = init_large_stack_size();
huge_stacksize = init_huge_stack_size();

#if defined(__linux) || defined(linux) || defined(__linux__)
init_use_stack_guard_pages();
#endif
reconfigure();
}

void runtime_configuration::reconfigure(
std::vector<std::string> const& cmdline_ini_defs_)
{
cmdline_ini_defs = cmdline_ini_defs_;
reconfigure();
}

void runtime_configuration::reconfigure()
{
pre_initialize_ini();

std::vector<std::string> const& prefill =
Expand All @@ -329,7 +313,7 @@ namespace hpx { namespace util
huge_stacksize = init_huge_stack_size();

#if defined(__linux) || defined(linux) || defined(__linux__)
init_use_stack_guard_pages();
coroutines::detail::posix::use_guard_pages = init_use_stack_guard_pages();
#endif
}

Expand Down Expand Up @@ -650,16 +634,16 @@ namespace hpx { namespace util
}

#if defined(__linux) || defined(linux) || defined(__linux__)
void runtime_configuration::init_use_stack_guard_pages() const
bool runtime_configuration::init_use_stack_guard_pages() const
{
if (has_section("hpx")) {
util::section const* sec = get_section("hpx.stacks");
if (NULL != sec) {
std::string entry = sec->get_entry("use_guard_pages", "1");
coroutines::detail::posix::use_guard_pages =
(entry != "0") ? true : false;
return (entry != "0") ? true : false;
}
}
return true; // default is true
}
#endif

Expand Down

0 comments on commit 6e336b2

Please sign in to comment.