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
7276b680
Unverified
Commit
7276b680
authored
Apr 13, 2020
by
Luca Boccassi
Committed by
GitHub
Apr 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3868 from gummif/gfa/poller-sleep
Problem: poller sleeps forever if no events
parents
ef4bb9aa
458d805e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
zmq_poller.txt
doc/zmq_poller.txt
+2
-1
socket_poller.cpp
src/socket_poller.cpp
+5
-0
test_poller.cpp
tests/test_poller.cpp
+14
-0
No files found.
doc/zmq_poller.txt
View file @
7276b680
...
...
@@ -256,7 +256,8 @@ At least one of the registered objects is a 'socket' whose associated 0MQ
'context' was terminated.
*EFAULT*::
The provided 'events' was NULL, or 'poller' did not point to a valid poller,
or there are no registered objects and 'timeout' was negative.
or there are no registered objects or all event subscriptions are disabled
and 'timeout' was negative.
*EINTR*::
The operation was interrupted by delivery of a signal before any events were
available.
...
...
src/socket_poller.cpp
View file @
7276b680
...
...
@@ -549,6 +549,11 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_,
}
if
(
unlikely
(
_pollset_size
==
0
))
{
if
(
timeout_
<
0
)
{
// Fail instead of trying to sleep forever
errno
=
EFAULT
;
return
-
1
;
}
// We'll report an error (timed out) as if the list was non-empty and
// no event occurred within the specified timeout. Otherwise the caller
// needs to check the return value AND the event to avoid using the
...
...
tests/test_poller.cpp
View file @
7276b680
...
...
@@ -512,6 +512,17 @@ void call_poller_wait_all_empty_with_timeout_fails (void *poller_,
zmq_poller_wait_all
(
poller_
,
&
event
,
0
,
-
1
));
}
void
call_poller_wait_all_inf_disabled_fails
(
void
*
poller_
,
void
*
socket_
)
{
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_add
(
poller_
,
socket_
,
NULL
,
0
));
zmq_poller_event_t
events
[
1
];
TEST_ASSERT_FAILURE_ERRNO
(
EAGAIN
,
zmq_poller_wait_all
(
poller_
,
events
,
1
,
0
));
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_wait_all
(
poller_
,
events
,
1
,
-
1
));
}
TEST_CASE_FUNC_PARAM
(
call_poller_wait_empty_with_timeout_fails
,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_empty_without_timeout_fails
,
...
...
@@ -522,6 +533,8 @@ TEST_CASE_FUNC_PARAM (call_poller_wait_all_empty_without_timeout_fails,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_all_empty_with_timeout_fails
,
test_with_empty_poller
)
TEST_CASE_FUNC_PARAM
(
call_poller_wait_all_inf_disabled_fails
,
test_with_empty_poller
)
void
test_poll_basic
()
{
...
...
@@ -695,6 +708,7 @@ int main (void)
RUN_TEST
(
test_call_poller_wait_all_empty_negative_count_fails
);
RUN_TEST
(
test_call_poller_wait_all_empty_without_timeout_fails
);
RUN_TEST
(
test_call_poller_wait_all_empty_with_timeout_fails
);
RUN_TEST
(
test_call_poller_wait_all_inf_disabled_fails
);
RUN_TEST
(
test_call_poller_fd_no_signaler
);
RUN_TEST
(
test_call_poller_fd
);
...
...
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