/** * 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. */ #ifndef INC_notifierConveyor_H #define INC_notifierConveyor_H #include #include #include #include #include #include namespace epics { namespace pvAccess { namespace ca { class Notification; typedef std::tr1::shared_ptr NotificationPtr; typedef std::tr1::weak_ptr NotificationWPtr; class NotifierClient; typedef std::tr1::shared_ptr NotifierClientPtr; typedef std::tr1::weak_ptr NotifierClientWPtr; class NotifierClient { public: virtual ~NotifierClient() {}; virtual void notifyClient() = 0; }; class Notification { public: Notification(void) : queued(false) {} explicit Notification(NotifierClientPtr const &c) : client(c), queued(false) {} void setClient(NotifierClientPtr const &client) { this->client = client; } private: NotifierClientWPtr client; bool queued; friend class NotifierConveyor; }; class epicsShareClass NotifierConveyor : public epicsThreadRunable { public: NotifierConveyor() : halt(false) {} ~NotifierConveyor(); virtual void run(); void start(); void notifyClient(NotificationPtr const ¬ificationPtr); private: std::tr1::shared_ptr thread; epicsMutex mutex; epicsEvent workToDo; std::queue workQueue; bool halt; }; }}} #endif /* INC_notifierConveyor_H */