Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libuev wrap on e_poll #542

Open
lindarean opened this issue Mar 2, 2024 · 0 comments
Open

libuev wrap on e_poll #542

lindarean opened this issue Mar 2, 2024 · 0 comments

Comments

@lindarean
Copy link

here is my code snippet with zmq_poll which is correctly working and when i send message to zmq from another application then message also goes to zmq
int ZMQGateway::zmqReceiverThread() {
LOG_INFO("Starting zmq receiver thread");
zmq_pollitem_t zmqItems[] = {
{zmqReqSocket, 0, ZMQ_POLLIN, 0},
{zmqRespSocket, 0, ZMQ_POLLIN, 0},
};

while (runZmq) {
    zmq_poll(zmqItems, 2, -1);
    if (zmqItems[0].revents & ZMQ_POLLIN) {......
      }

But here is the problem when i run using libuev (wrapper on e_poll) then the application starts also but there is not communication with the application or we can say the messages not goes to zmq server.

int evse::ZMQGateway::zmqReceiverThread() {

int zmqReqFd = zmqReqSocket.getsockopt<int>(ZMQ_FD);
int zmqRespFd = zmqRespSocket.getsockopt<int>(ZMQ_FD);

// Initialize libuEv I/O watchers
uev_io_init(&uevContext, &reqWatcher, handleZmqreqSocketEvent,nullptr,zmqReqFd, UEV_READ | UEV_EDGE);

uev_io_init(&uevContext, &respWatcher, handleZmqrespSocketEvent, nullptr,zmqRespFd ,UEV_READ);

// Run libuEv event loop
uev_run(&uevContext, 0);

return SUCCESS;

}

In this code i have use the one Event context and 2 watcher , 2 callback functions for the request and response socket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant