Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
5dcbc343
Commit
5dcbc343
authored
Feb 08, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zmq_poll with no fds behaves decently
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
908b39bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
zmq.cpp
src/zmq.cpp
+30
-0
No files found.
src/zmq.cpp
View file @
5dcbc343
...
...
@@ -44,6 +44,7 @@
#include "msg_content.hpp"
#include "stdint.hpp"
#include "config.hpp"
#include "likely.hpp"
#include "clock.hpp"
#include "ctx.hpp"
#include "err.hpp"
...
...
@@ -352,6 +353,20 @@ int zmq_recv (void *s_, zmq_msg_t *msg_, int flags_)
int
zmq_poll
(
zmq_pollitem_t
*
items_
,
int
nitems_
,
long
timeout_
)
{
#if defined ZMQ_POLL_BASED_ON_POLL
if
(
unlikely
(
nitems_
<
0
))
{
errno
=
EINVAL
;
return
-
1
;
}
if
(
unlikely
(
nitems_
==
0
))
{
if
(
timeout_
==
0
)
return
0
;
#if defined ZMQ_HAVE_WINDOWS
Sleep
(
timeout_
>
0
?
timeout_
/
1000
:
INFINITE
);
return
0
;
#else
return
usleep
(
timeout_
);
#endif
}
if
(
!
items_
)
{
errno
=
EFAULT
;
...
...
@@ -491,6 +506,21 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
#elif defined ZMQ_POLL_BASED_ON_SELECT
if
(
unlikely
(
nitems_
<
0
))
{
errno
=
EINVAL
;
return
-
1
;
}
if
(
unlikely
(
nitems_
==
0
))
{
if
(
timeout_
==
0
)
return
0
;
#if defined ZMQ_HAVE_WINDOWS
Sleep
(
timeout_
>
0
?
timeout_
/
1000
:
INFINITE
);
return
0
;
#else
return
usleep
(
timeout_
);
#endif
}
if
(
!
items_
)
{
errno
=
EFAULT
;
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment