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

RFE: Expose fd to easily attach to another event loop #51

Closed
lestrrat opened this issue Aug 26, 2010 · 1 comment
Closed

RFE: Expose fd to easily attach to another event loop #51

lestrrat opened this issue Aug 26, 2010 · 1 comment

Comments

@lestrrat
Copy link

I basically want to plug zeromq into another event loop, so that the I/O watcher of that event loop can handle readable file descriptors.

I'm actually doing this for the perl binding. The end effect I want is something like:

 my $w;
 $w = AnyEvent->io( fh => $socket->fd, poll => "r", callback => sub {
      my $msg = $socket->recv( ZMQ_NOBLOCK );
      if ($msg) {
           undef $w;
           process_message( $msg );
      }
 } );

which would be doable if the socket constructs has some sort of accessor to the underlying file descriptor. (And since I'm using the C wrapper, an equivalent C function to go along with it)

Would something like this be feasible in the next coming version?

@sustrik
Copy link
Member

sustrik commented Aug 30, 2010

The functionality is already merged in the trunk (to be released as 0MQ/2.1). Use ZMQ_FD socket option to get the file descriptor. Note that it signaling POLLIN means just "something happened with the socket". You still have to check another socket option (ZMQ_EVENTS) to find out whether the socket became readble/writable.

csrl pushed a commit to exosite-archive/zeromq2 that referenced this issue Dec 22, 2012
Fix zeromq#366 - On Windows, preventing sockets to be inherited by child processes.
drahosp pushed a commit to LuaDist/libzmq that referenced this issue Feb 13, 2014
Backported fixes for LIBZMQ-447
benjdero pushed a commit to benjdero/libzmq that referenced this issue Feb 20, 2023
Small changes for protocol documentation
This issue was closed.
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

2 participants