29 #ifndef PIRANHA_INIT_HPP 30 #define PIRANHA_INIT_HPP 35 #include <piranha/detail/init_data.hpp> 36 #include <piranha/detail/mpfr.hpp> 45 inline void cleanup_function()
47 std::cout <<
"Freeing MPFR caches.\n";
49 std::cout <<
"Setting shutdown flag.\n";
50 piranha_init_statics<>::s_shutdown_flag.store(
true);
83 if (piranha_init_statics<>::s_init_flag.test_and_set()) {
86 ++piranha_init_statics<>::s_failed;
89 std::cout <<
"Initializing piranha.\n";
90 if (std::atexit(cleanup_function)) {
91 std::cerr <<
"Unable to register cleanup function with std::atexit().\n";
95 if (!::mpfr_buildopt_tls_p()) {
98 std::cerr <<
"The MPFR library was not built thread-safe.\n";
void init()
Main initialisation function.