| | |
| | | */ |
| | | |
| | | #include "socket.h" |
| | | #include <chrono> |
| | | #include "msg.h" |
| | | #include "defs.h" |
| | | #include "bh_util.h" |
| | | #include "defs.h" |
| | | #include "msg.h" |
| | | #include <chrono> |
| | | |
| | | using namespace bhome_msg; |
| | | using namespace bhome_shm; |
| | | using namespace std::chrono_literals; |
| | | |
| | | namespace { |
| | | namespace |
| | | { |
| | | |
| | | int GetSocketDefaultLen(ShmSocket::Type type) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | } // namespace |
| | | |
| | | } |
| | | |
| | | ShmSocket::ShmSocket(Type type, bhome_shm::SharedMemory &shm) |
| | | : shm_(shm), |
| | | type_(type), |
| | | run_(false) |
| | | ShmSocket::ShmSocket(Type type, bhome_shm::SharedMemory &shm) : |
| | | shm_(shm), type_(type), run_(false) |
| | | { |
| | | int len = GetSocketDefaultLen(type); |
| | | if (len != 0) { |
| | |
| | | this->onRecv_(msg); |
| | | } |
| | | } |
| | | } catch (...) {} |
| | | } catch (...) { |
| | | } |
| | | } |
| | | }; |
| | | run_.store(true); |
| | | workers_.emplace_back(RecvProc); |
| | | } |
| | | } |
| | | ShmSocket::ShmSocket(Type type) |
| | | : ShmSocket(type, BHomeShm()) |
| | | |
| | | ShmSocket::ShmSocket(Type type) : |
| | | ShmSocket(type, BHomeShm()) |
| | | { |
| | | } |
| | | |