23using namespace std::chrono_literals;
29 RCLCPP_INFO_STREAM(
getLogger(),
"[" <<
getName() <<
"] Creating asynchronous onEntry thread");
34 getLogger(),
"[" <<
getName() <<
"] onEntry asynchronous thread was finished.");
46 bool valid = threadfut.valid();
49 auto status = threadfut.wait_for(std::chrono::milliseconds(20));
50 if (status == std::future_status::ready)
58 rclcpp::sleep_for(100ms);
62 "[%s] waiting for finishing client behavior, before leaving the state. Is the client "
67 catch (
const std::exception & e)
71 "[SmaccAsyncClientBehavior] trying to join function, but it was already finished.");
77 RCLCPP_INFO_STREAM(
getLogger(),
"[" <<
getName() <<
"] onExit - join async onEntry thread");
82 getLogger(),
"[" <<
getName() <<
"] onExit - Creating asynchronous onExit thread");
94 <<
"] Destroying client behavior- Waiting finishing of asynchronous onExit thread");
103 "[SmaccAsyncClientBehavior] trying to Join onExit function, but it was already finished.");
109 <<
"] Destroying client behavior- onExit thread finished. Proccedding destruction.");
std::string getName() const
virtual rclcpp::Logger getLogger()
virtual rclcpp::Node::SharedPtr getNode()
virtual ~SmaccAsyncClientBehavior()
std::function< void()> postSuccessEventFn_
std::function< void()> postFinishEventFn_
void waitFutureIfNotFinished(std::future< int > &threadfut)
void executeOnEntry() override
std::future< int > onExitThread_
virtual void dispose() override
void executeOnExit() override
std::function< void()> postFailureEventFn_
std::future< int > onEntryThread_
std::string demangleType(const std::type_info *tinfo)