/** * 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.06 */ #ifndef MonitorEventThread_H #define MonitorEventThread_H #include #include #include #include #include #include namespace epics { namespace pvAccess { namespace ca { class NotifyMonitorRequester; typedef std::tr1::shared_ptr NotifyMonitorRequesterPtr; typedef std::tr1::weak_ptr NotifyMonitorRequesterWPtr; class MonitorEventThread; typedef std::tr1::shared_ptr MonitorEventThreadPtr; class CAChannelMonitor; typedef std::tr1::shared_ptr CAChannelMonitorPtr; typedef std::tr1::weak_ptr CAChannelMonitorWPtr; class NotifyMonitorRequester { public: MonitorRequester::weak_pointer monitorRequester; CAChannelMonitorWPtr channelMonitor; bool isOnQueue; NotifyMonitorRequester() : isOnQueue(false) {} void setChannelMonitor(CAChannelMonitorPtr const &channelMonitor) { this->channelMonitor = channelMonitor;} }; class MonitorEventThread : public epicsThreadRunable { public: static MonitorEventThreadPtr get(); ~MonitorEventThread(); virtual void run(); void start(); void stop(); void event(NotifyMonitorRequesterPtr const ¬ifyMonitorRequester); private: MonitorEventThread(); bool isStop; std::tr1::shared_ptr thread; epics::pvData::Mutex mutex; epics::pvData::Event waitForCommand; epics::pvData::Event waitForStop; std::queue notifyMonitorQueue; }; }}} #endif /* MonitorEventThread_H */