23using namespace std::chrono_literals;
29 RCLCPP_INFO_STREAM(
getLogger(),
"[" <<
getName() <<
"] Creating asynchronous onEntry thread");
37 getLogger(),
"[" <<
getName() <<
"] onEntry asynchronous thread was finished.");
49 bool valid = threadfut.valid();
52 auto status = threadfut.wait_for(std::chrono::milliseconds(20));
53 if (status == std::future_status::ready)
61 rclcpp::sleep_for(100ms);
65 "[%s] waiting for finishing client behavior, before leaving the state. Is the client "
70 catch (
const std::exception & e)
74 "[SmaccAsyncClientBehavior] trying to join function, but it was already finished.");
80 RCLCPP_INFO_STREAM(
getLogger(),
"[" <<
getName() <<
"] onExit - join async onEntry thread");
85 getLogger(),
"[" <<
getName() <<
"] onExit - Creating asynchronous onExit thread");
100 <<
"] Destroying client behavior- Waiting finishing of asynchronous onExit thread");
109 "[SmaccAsyncClientBehavior] trying to Join onExit function, but it was already finished.");
115 <<
"] 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)