| | |
| | | #define PUBSUB_4KGRA997 |
| | | |
| | | #include "shm_queue.h" |
| | | #include <thread> |
| | | #include <atomic> |
| | | #include <mutex> |
| | | #include <vector> |
| | | #include <unordered_map> |
| | | #include <set> |
| | | #include <thread> |
| | | #include <unordered_map> |
| | | #include <vector> |
| | | |
| | | namespace bhome_shm { |
| | | namespace bhome_shm |
| | | { |
| | | |
| | | // publish/subcribe manager. |
| | | class BusManager |
| | | { |
| | | SharedMemory &shm_; |
| | | ShmMsgQueue busq_; |
| | | std::atomic<bool> run_; |
| | | std::vector<std::thread> workers_; |
| | | std::mutex mutex_; |
| | | typedef std::set<MQId> Clients; |
| | | std::unordered_map<std::string, Clients> records_; |
| | | SharedMemory &shm_; |
| | | ShmMsgQueue busq_; |
| | | std::atomic<bool> run_; |
| | | std::vector<std::thread> workers_; |
| | | std::mutex mutex_; |
| | | typedef std::set<MQId> Clients; |
| | | std::unordered_map<std::string, Clients> records_; |
| | | |
| | | bool StopNoLock(); |
| | | void OnMsg(MsgI &msg); |
| | | bool StopNoLock(); |
| | | void OnMsg(MsgI &msg); |
| | | |
| | | public: |
| | | BusManager(SharedMemory &shm); |
| | | ~BusManager(); |
| | | bool Start(const int nworker = 2); |
| | | bool Stop(); |
| | | BusManager(SharedMemory &shm); |
| | | ~BusManager(); |
| | | bool Start(const int nworker = 2); |
| | | bool Stop(); |
| | | }; |
| | | |
| | | |
| | | } // namespace bhome_shm |
| | | |