Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making sure the correct number of threads is registered with AGAS #1233

Merged
merged 4 commits into from Aug 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 17 additions & 12 deletions docs/hpx.idx
Expand Up @@ -154,21 +154,22 @@ throws "" "header\.hpx\.exception_hpp"
make_error_code "" "header\.hpx\.exception_hpp"
make_success_code "" "header\.hpx\.exception_hpp"

diagnostic_information "" "hpx\.diagnostic_information.*"
get_error_locality_id "" "hpx\.get_error_locality_id.*"
get_error_error "" "hpx\.get_error_error.*"
get_error_host_name "" "hpx\.get_error_host_name.*"
get_error_process_id "" "hpx\.get_error_process_id.*"
get_error_function_name "" "hpx\.get_error_function_name.*"
get_error_file_name "" "hpx\.get_error_file_name.*"
get_error_line_number "" "hpx\.get_error_line_number.*"
get_error_os_thread "" "hpx\.get_error_os_thread.*"
get_error_thread_id "" "hpx\.get_error_thread_id.*"
get_error_thread_description "" "hpx\.get_error_thread_description.*"
get_error_backtrace "" "hpx\.get_error_backtrace.*"
diagnostic_information "" "hpx\.diagnostic_inform.*"
get_error_locality_id "" "hpx\.get_error_localit.*"
get_error "" "hpx\.get_error_id.*"
get_error_host_name "" "hpx\.get_error_ho.*"
get_error_process_id "" "hpx\.get_error_process.*"
get_error_function_name "" "hpx\.get_error_functio.*"
get_error_file_name "" "hpx\.get_error_file_na.*"
get_error_line_number "" "hpx\.get_error_line_nu.*"
get_error_os_thread "" "hpx\.get_error_os_thre.*"
get_error_thread_id "" "hpx\.get_error_thread_.*"
get_error_thread_description "" "hpx\.get_error_thread_.*"
get_error_backtrace "" "hpx\.get_error_backtra.*"
get_error_what "" "hpx\.get_error_what.*"
get_error_env "" "hpx\.get_error_env.*"
get_error_config "" "hpx\.get_error_config.*"
get_error_state "" "hpx\.get_error_state.*"


# hpx/error.hpp
Expand Down Expand Up @@ -226,6 +227,10 @@ bad_plugin_type "" "hpx\.error"
filesystem_error "" "hpx\.error"
bad_function_call "" "hpx\.error"
security_error "" "hpx\.error"
filesystem_error "" "hpx\.error"
bad_function_call "" "hpx\.error"
task_canceled_exception "" "hpx\.error"
task_region_not_active "" "hpx\.error"

# hpx/runtime/naming/unmanaged.hpp
unmanaged "" "header\.hpx\.runtime\.naming\.unmanaged.*"
Expand Down
42 changes: 21 additions & 21 deletions docs/manual/exceptions.qbk
Expand Up @@ -84,41 +84,41 @@ instance can be used in a very similar way as the
retrieves all available diagnostic information from the error code instance as
a formatted string.

As for handling exceptions, when working with error codes, under certain
As for handling exceptions, when working with error codes, under certain
circumstances it is desireable to output only some of the
diagnostics, or to output those using different formatting. For this case, __hpx__
exposes a set of lower level functions usable with error codes as demonstrated
exposes a set of lower level functions usable with error codes as demonstrated
in the following code snippet:

[error_handling_diagnostic_elements]

For more information please refer to the documentation of
[funcref hpx::get_error_what `hpx::get_error_what()`],
[funcref hpx::get_error_locality_id `hpx::get_error_locality_id()`],
[funcref hpx::get_error_host_name `hpx::get_error_host_name()`],
[funcref hpx::get_error_process_id `hpx::get_error_process_id()`],
[funcref hpx::get_error_function_name `hpx::get_error_function_name()`],
[funcref hpx::get_error_file_name `hpx::get_error_file_name()`],
[funcref hpx::get_error_line_number `hpx::get_error_line_number()`],
[funcref hpx::get_error_os_thread `hpx::get_error_os_thread()`],
[funcref hpx::get_error_thread_id `hpx::get_error_thread_id()`], and
[funcref hpx::get_error_thread_description `hpx::get_error_thread_description()`]
[funcref hpx::get_error_backtrace `hpx::get_error_backtrace()`]
[funcref hpx::get_error_env `hpx::get_error_env()`]
for more details.
[funcref hpx::get_error_what `hpx::get_error_what`],
[funcref hpx::get_error_locality_id `hpx::get_error_locality_id`],
[funcref hpx::get_error_host_name `hpx::get_error_host_name`],
[funcref hpx::get_error_process_id `hpx::get_error_process_id`],
[funcref hpx::get_error_function_name `hpx::get_error_function_name`],
[funcref hpx::get_error_file_name `hpx::get_error_file_name`],
[funcref hpx::get_error_line_number `hpx::get_error_line_number`],
[funcref hpx::get_error_os_thread `hpx::get_error_os_thread`],
[funcref hpx::get_error_thread_id `hpx::get_error_thread_id`],
[funcref hpx::get_error_thread_description `hpx::get_error_thread_description`],
[funcref hpx::get_error_backtrace `hpx::get_error_backtrace`],
[funcref hpx::get_error_env `hpx::get_error_env`], and
[funcref hpx::get_error_state `hpx::get_error_state`].

[heading:lightweight_error_code Lightweight error Codes]

Sometimes it is not desireable to collect all the ambient information about the
error at the point where it happened as this might impose too much overhead for
simple scenarious. In this case, __hpx__ provides a lightweight error code
facility which will hold the error code only. The following snippet demonstrates
Sometimes it is not desireable to collect all the ambient information about the
error at the point where it happened as this might impose too much overhead for
simple scenarious. In this case, __hpx__ provides a lightweight error code
facility which will hold the error code only. The following snippet demonstrates
its use:

[lightweight_error_handling_diagnostic_information]

All functions which retrieve other diagnostic elements from the
[classref hpx::error_code `hpx::error_code`] will fail if called with a
All functions which retrieve other diagnostic elements from the
[classref hpx::error_code `hpx::error_code`] will fail if called with a
lightweight error_code instance.

[endsect] [/ Working with Exceptions]
Expand Down
4 changes: 3 additions & 1 deletion examples/quickstart/error_handling.cpp
Expand Up @@ -4,7 +4,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This example is documented in the Manual under the title "Error Handling"
// This example is documented in the Manual under the title "Error Handling"
#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/include/iostreams.hpp>
Expand Down Expand Up @@ -63,6 +63,7 @@ int hpx_main()
hpx::cout << "{thread-id}: " << std::hex << hpx::get_error_thread_id(e) << "\n";
hpx::cout << "{thread-description}: "
<< hpx::get_error_thread_description(e) << "\n";
hpx::cout << "{state}: " << std::hex << hpx::get_error_state(e) << "\n";
hpx::cout << "{stack-trace}: " << hpx::get_error_backtrace(e) << "\n";
hpx::cout << "{env}: " << hpx::get_error_env(e) << "\n";
}
Expand Down Expand Up @@ -125,6 +126,7 @@ int hpx_main()
hpx::cout << "{thread-id}: " << std::hex << hpx::get_error_thread_id(ec) << "\n";
hpx::cout << "{thread-description}: "
<< hpx::get_error_thread_description(ec) << "\n\n";
hpx::cout << "{state}: " << std::hex << hpx::get_error_state(ec) << "\n";
hpx::cout << "{stack-trace}: " << hpx::get_error_backtrace(ec) << "\n";
hpx::cout << "{env}: " << hpx::get_error_env(ec) << "\n";
}
Expand Down
100 changes: 83 additions & 17 deletions hpx/exception.hpp
Expand Up @@ -164,7 +164,8 @@ namespace hpx
get_exception(Exception const& e,
std::string const& func = "<unknown>",
std::string const& file = "<unknown>",
long line = -1);
long line = -1,
std::string const& auxinfo = "");
}
/// \endcond

Expand Down Expand Up @@ -681,6 +682,8 @@ namespace hpx
struct tag_throw_stacktrace {};
struct tag_throw_env {};
struct tag_throw_config {};
struct tag_throw_state {};
struct tag_throw_auxinfo {};

// Stores the information about the locality id the exception has been
// raised on. This information will show up in error messages under the
Expand Down Expand Up @@ -753,6 +756,17 @@ namespace hpx
typedef boost::error_info<detail::tag_throw_config, std::string>
throw_config;

// Stores the current runtime state. This information will show up in
// error messages under the [state] tag.
typedef boost::error_info<detail::tag_throw_state, std::string>
throw_state;

// Stores additional auxiliary information (such as information about
// the current parcel). This information will show up in error messages
// under the [auxinfo] tag.
typedef boost::error_info<detail::tag_throw_auxinfo, std::string>
throw_auxinfo;

// construct an exception, internal helper
template <typename Exception>
HPX_EXPORT boost::exception_ptr
Expand All @@ -762,7 +776,8 @@ namespace hpx
std::string const& hostname = "", boost::int64_t pid = -1,
std::size_t shepherd = ~0, std::size_t thread_id = 0,
std::string const& thread_name = "",
std::string const& env = "", std::string const& config = "");
std::string const& env = "", std::string const& config = "",
std::string const& state = "", std::string const& auxinfo = "");

template <typename Exception>
HPX_EXPORT boost::exception_ptr
Expand Down Expand Up @@ -832,7 +847,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::string diagnostic_information(hpx::exception const& e);

Expand Down Expand Up @@ -873,7 +889,7 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error()
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_config()
/// \a hpx::get_error_config(), \a hpx::get_error_state()
///
HPX_EXPORT std::string get_error_what(hpx::exception const& e);

Expand Down Expand Up @@ -911,7 +927,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT boost::uint32_t get_error_locality_id(hpx::exception const& e);

Expand Down Expand Up @@ -948,7 +965,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT error get_error(hpx::exception const& e);

Expand Down Expand Up @@ -985,7 +1003,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error()
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::string get_error_host_name(hpx::exception const& e);

Expand Down Expand Up @@ -1023,7 +1042,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT boost::int64_t get_error_process_id(hpx::exception const& e);

Expand Down Expand Up @@ -1061,7 +1081,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::string get_error_env(hpx::exception const& e);

Expand Down Expand Up @@ -1098,7 +1119,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::string get_error_function_name(hpx::exception const& e);

Expand Down Expand Up @@ -1135,7 +1157,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::string get_error_backtrace(hpx::exception const& e);

Expand Down Expand Up @@ -1174,7 +1197,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::string get_error_file_name(hpx::exception const& e);

Expand Down Expand Up @@ -1212,7 +1236,8 @@ namespace hpx
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT int get_error_line_number(hpx::exception const& e);

Expand Down Expand Up @@ -1251,7 +1276,8 @@ namespace hpx
/// \a hpx::get_error_thread_id(),
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::size_t get_error_os_thread(hpx::exception const& e);

Expand Down Expand Up @@ -1290,7 +1316,8 @@ namespace hpx
/// \a hpx::get_error_os_thread()
/// \a hpx::get_error_thread_description(), \a hpx::get_error(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
/// \a hpx::get_error_what(), \a hpx::get_error_config(),
/// \a hpx::get_error_state()
///
HPX_EXPORT std::size_t get_error_thread_id(hpx::exception const& e);

Expand Down Expand Up @@ -1328,7 +1355,7 @@ namespace hpx
/// \a hpx::get_error_file_name(), \a hpx::get_error_line_number(),
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error(),
/// \a hpx::get_error(), \a hpx::get_error_state(),
/// \a hpx::get_error_what(), \a hpx::get_error_config()
///
HPX_EXPORT std::string get_error_thread_description(hpx::exception const& e);
Expand Down Expand Up @@ -1367,7 +1394,7 @@ namespace hpx
/// \a hpx::get_error_file_name(), \a hpx::get_error_line_number(),
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error(),
/// \a hpx::get_error(), \a hpx::get_error_state()
/// \a hpx::get_error_what(), \a hpx::get_error_thread_description()
///
HPX_EXPORT std::string get_error_config(hpx::exception const& e);
Expand All @@ -1380,6 +1407,45 @@ namespace hpx
HPX_EXPORT std::string get_error_config(boost::exception_ptr const& e);
/// \endcond

/// \brief Return the HPX runtime state information at which the exception
/// was thrown.
///
/// The function \a hpx::get_error_state can be used to extract the
/// HPX runtime state information element representing the state the
/// runtime system is currently in as stored in the given exception
/// instance.
///
/// \returns The point runtime state at the point at which the exception
/// was thrown. If the exception instance does not hold
/// this information, the function will return an empty string.
///
/// \param e The parameter \p e will be inspected for the requested
/// diagnostic information elements which have been stored at
/// the point where the exception was thrown. This parameter
/// can be one of the following types: \a hpx::exception,
/// \a hpx::error_code, \a boost::exception, or
/// \a boost::exception_ptr.
///
/// \throws std#bad_alloc (if one of the required allocations fails)
///
/// \see \a hpx::diagnostic_information(), \a hpx::get_error_host_name(),
/// \a hpx::get_error_process_id(), \a hpx::get_error_function_name(),
/// \a hpx::get_error_file_name(), \a hpx::get_error_line_number(),
/// \a hpx::get_error_os_thread(), \a hpx::get_error_thread_id(),
/// \a hpx::get_error_backtrace(), \a hpx::get_error_env(),
/// \a hpx::get_error(),
/// \a hpx::get_error_what(), \a hpx::get_error_thread_description()
///
HPX_EXPORT std::string get_error_state(hpx::exception const& e);

/// \copydoc get_error_state(hpx::exception const& e)
HPX_EXPORT std::string get_error_state(hpx::error_code const& e);

/// \cond NOINTERNAL
HPX_EXPORT std::string get_error_state(boost::exception const& e);
HPX_EXPORT std::string get_error_state(boost::exception_ptr const& e);
/// \endcond

///////////////////////////////////////////////////////////////////////////
// \cond NOINTERNAL
inline error_code::error_code(error e, throwmode mode)
Expand Down