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
4a651251
Commit
4a651251
authored
Jun 01, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: code duplication within socket_poller_t
Solution: remove duplicated code
parent
74d3d842
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
28 deletions
+6
-28
socket_poller.cpp
src/socket_poller.cpp
+6
-28
No files found.
src/socket_poller.cpp
View file @
4a651251
...
...
@@ -42,10 +42,7 @@ static bool is_thread_safe (zmq::socket_base_t &socket_)
zmq
::
socket_poller_t
::
socket_poller_t
()
:
_tag
(
0xCAFEBABE
),
_signaler
(
NULL
),
_need_rebuild
(
true
),
_use_signaler
(
false
),
_pollset_size
(
0
)
_signaler
(
NULL
)
#if defined ZMQ_POLL_BASED_ON_POLL
,
_pollfds
(
NULL
)
...
...
@@ -54,20 +51,7 @@ zmq::socket_poller_t::socket_poller_t () :
_max_fd
(
0
)
#endif
{
#if defined ZMQ_POLL_BASED_ON_SELECT
#if defined ZMQ_HAVE_WINDOWS
// On Windows fd_set contains array of SOCKETs, each 4 bytes.
// For large fd_sets memset() could be expensive and it is unnecessary.
// It is enough to set fd_count to 0, exactly what FD_ZERO() macro does.
FD_ZERO
(
&
_pollset_in
);
FD_ZERO
(
&
_pollset_out
);
FD_ZERO
(
&
_pollset_err
);
#else
memset
(
&
_pollset_in
,
0
,
sizeof
(
_pollset_in
));
memset
(
&
_pollset_out
,
0
,
sizeof
(
_pollset_out
));
memset
(
&
_pollset_err
,
0
,
sizeof
(
_pollset_err
));
#endif
#endif
rebuild
();
}
zmq
::
socket_poller_t
::~
socket_poller_t
()
...
...
@@ -271,6 +255,10 @@ int zmq::socket_poller_t::remove_fd (fd_t fd_)
void
zmq
::
socket_poller_t
::
rebuild
()
{
_use_signaler
=
false
;
_pollset_size
=
0
;
_need_rebuild
=
false
;
#if defined ZMQ_POLL_BASED_ON_POLL
if
(
_pollfds
)
{
...
...
@@ -278,10 +266,6 @@ void zmq::socket_poller_t::rebuild ()
_pollfds
=
NULL
;
}
_use_signaler
=
false
;
_pollset_size
=
0
;
for
(
items_t
::
iterator
it
=
_items
.
begin
();
it
!=
_items
.
end
();
++
it
)
{
if
(
it
->
events
)
{
if
(
it
->
socket
&&
is_thread_safe
(
*
it
->
socket
))
{
...
...
@@ -342,10 +326,6 @@ void zmq::socket_poller_t::rebuild ()
// file descriptors.
zmq_assert
(
_items
.
size
()
<=
FD_SETSIZE
);
_pollset_size
=
0
;
_use_signaler
=
false
;
for
(
items_t
::
iterator
it
=
_items
.
begin
();
it
!=
_items
.
end
();
++
it
)
{
if
(
it
->
socket
&&
is_thread_safe
(
*
it
->
socket
)
&&
it
->
events
)
{
_use_signaler
=
true
;
...
...
@@ -395,8 +375,6 @@ void zmq::socket_poller_t::rebuild ()
}
#endif
_need_rebuild
=
false
;
}
void
zmq
::
socket_poller_t
::
zero_trail_events
(
...
...
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