/** * Copyright - See the COPYRIGHT that is included with this distribution. * pvAccessCPP is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ /** * @author mrk * @date 2018.07 */ #ifndef ChannelConnectThread_H #define ChannelConnectThread_H #include #include #include #include #include #include namespace epics { namespace pvAccess { namespace ca { class NotifyChannelRequester; typedef std::tr1::shared_ptr NotifyChannelRequesterPtr; typedef std::tr1::weak_ptr NotifyChannelRequesterWPtr; class ChannelConnectThread; typedef std::tr1::shared_ptr ChannelConnectThreadPtr; class CAChannel; typedef std::tr1::shared_ptr CAChannelPtr; typedef std::tr1::weak_ptr CAChannelWPtr; class NotifyChannelRequester { public: ChannelRequester::weak_pointer channelRequester; CAChannelWPtr channel; bool isOnQueue; NotifyChannelRequester() : isOnQueue(false) {} void setChannel(CAChannelPtr const &channel) { this->channel = channel;} }; class ChannelConnectThread : public epicsThreadRunable { public: static ChannelConnectThreadPtr get(); ~ChannelConnectThread(); virtual void run(); void start(); void stop(); void channelConnected(NotifyChannelRequesterPtr const ¬ifyChannelRequester); private: ChannelConnectThread(); bool isStop; std::tr1::shared_ptr thread; epics::pvData::Mutex mutex; epics::pvData::Event waitForCommand; epics::pvData::Event waitForStop; std::queue notifyChannelQueue; }; }}} #endif /* ChannelConnectThread_H */