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
19dd8195
Commit
19dd8195
authored
May 02, 2019
by
jean-airoldie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: Missing doc & unit tests for zmq_poller_fd
Solution: Add doc & unit tests
parent
92eedc57
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
zmq_poller.txt
doc/zmq_poller.txt
+12
-0
test_poller.cpp
tests/test_poller.cpp
+33
-0
No files found.
doc/zmq_poller.txt
View file @
19dd8195
...
...
@@ -21,11 +21,16 @@ SYNOPSIS
*int zmq_poller_modify_fd (void *'poller', int 'fd', short 'events');*
*int zmq_poller_remove_fd (void *'poller', int 'fd');*
*int zmq_poller_wait (void *'poller',
zmq_poller_event_t *'event',
long 'timeout');*
*int zmq_poller_wait_all (void *'poller',
zmq_poller_event_t *'events',
int 'n_events',
long 'timeout');*
*int zmq_poller_fd (void *'poller');*
DESCRIPTION
-----------
The _zmq_poller_*_ functions provide a mechanism for applications to multiplex
...
...
@@ -124,6 +129,10 @@ The client does therefore not need to initialize the contents of the events
array before a call to _zmq_poller_wait_all_. It is unspecified whether the
the remaining elements of 'events' are written to by _zmq_poller_wait_all_.
_zmq_poller_fd_ returns the file descriptor associated with the zmq_poller.
The zmq_poller is only guaranteed to have a file descriptor if
at least one thread-safe socket is currently registered.
EVENT TYPES
-----------
...
...
@@ -237,6 +246,9 @@ available.
*EAGAIN*::
No registered event was signalled before the timeout was reached.
On _zmq_poller_fd:
*EINVAL*::
The poller has no associated file descriptor.
EXAMPLE
-------
...
...
tests/test_poller.cpp
View file @
19dd8195
...
...
@@ -257,6 +257,36 @@ void test_with_valid_poller (extra_poller_func_t extra_func_)
test_context_socket_close
(
socket
);
}
void
test_call_poller_fd_no_signaler
()
{
void
*
socket
=
test_context_socket
(
ZMQ_PAIR
);
void
*
poller
=
zmq_poller_new
();
TEST_ASSERT_NOT_NULL
(
poller
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_add
(
poller
,
socket
,
NULL
,
ZMQ_POLLIN
));
TEST_ASSERT_FAILURE_ERRNO
(
EINVAL
,
zmq_poller_fd
(
poller
));
test_context_socket_close
(
socket
);
}
void
test_call_poller_fd
()
{
void
*
socket
=
test_context_socket
(
ZMQ_CLIENT
);
void
*
poller
=
zmq_poller_new
();
TEST_ASSERT_NOT_NULL
(
poller
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_add
(
poller
,
socket
,
NULL
,
ZMQ_POLLIN
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_fd
(
poller
));
test_context_socket_close
(
socket
);
}
void
call_poller_wait_null_event_fails
(
void
*
poller_
)
{
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_wait
(
poller_
,
NULL
,
0
));
...
...
@@ -652,6 +682,9 @@ int main (void)
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_fd_no_signaler
);
RUN_TEST
(
test_call_poller_fd
);
RUN_TEST
(
test_poll_basic
);
RUN_TEST
(
test_poll_fd
);
RUN_TEST
(
test_poll_client_server
);
...
...
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