1 //////////////////////////////////////////////////////////////////////////////// 2 // Copyright (c) 2011 Bryce Lelbach 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 //////////////////////////////////////////////////////////////////////////////// 7 8 #include <hpx/config.hpp> 9 #include <hpx/state.hpp> 10 #include <hpx/runtime.hpp> 11 #include <hpx/runtime/threads/threadmanager.hpp> 12 #include <hpx/runtime/naming/resolver_client.hpp> 13 14 /////////////////////////////////////////////////////////////////////////////// 15 namespace hpx 16 { 17 namespace threads 18 { 19 // return whether thread manager is in the state described by st threadmanager_is(state st)20 bool threadmanager_is(state st) 21 { 22 hpx::runtime* rt = get_runtime_ptr(); 23 if (nullptr == rt) { 24 // we're probably either starting or stopping 25 return st <= state_starting || st >= state_stopping; 26 } 27 return (rt->get_thread_manager().status() == st); 28 } threadmanager_is_at_least(state st)29 bool threadmanager_is_at_least(state st) 30 { 31 hpx::runtime* rt = get_runtime_ptr(); 32 if (nullptr == rt) { 33 // we're probably either starting or stopping 34 return false; 35 } 36 return (rt->get_thread_manager().status() >= st); 37 } 38 } 39 40 namespace agas 41 { 42 // return whether resolver client is in state described by st router_is(state st)43 bool router_is(state st) 44 { 45 runtime* rt = get_runtime_ptr(); 46 if (nullptr == rt) { 47 // we're probably either starting or stopping 48 return st == state_starting || st == state_stopping; 49 } 50 return (rt->get_agas_client().get_status() == st); 51 } 52 } 53 } 54 55