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
74d3d842
Commit
74d3d842
authored
Jun 01, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: huge stack allocation with select on Windows in socket_poller_t::wait
Solution: use optimized_fd_set_t
parent
3d39bb9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
socket_poller.cpp
src/socket_poller.cpp
+13
-8
No files found.
src/socket_poller.cpp
View file @
74d3d842
...
...
@@ -618,7 +618,9 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_,
bool
first_pass
=
true
;
fd_set
inset
,
outset
,
errset
;
optimized_fd_set_t
inset
(
_pollset_size
);
optimized_fd_set_t
outset
(
_pollset_size
);
optimized_fd_set_t
errset
(
_pollset_size
);
while
(
true
)
{
// Compute the timeout for the subsequent poll.
...
...
@@ -638,11 +640,14 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_,
// Wait for events. Ignore interrupts if there's infinite timeout.
while
(
true
)
{
memcpy
(
&
inset
,
&
_pollset_in
,
valid_pollset_bytes
(
_pollset_in
));
memcpy
(
&
outset
,
&
_pollset_out
,
valid_pollset_bytes
(
_pollset_out
));
memcpy
(
&
errset
,
&
_pollset_err
,
valid_pollset_bytes
(
_pollset_err
));
const
int
rc
=
select
(
static_cast
<
int
>
(
_max_fd
+
1
),
&
inset
,
&
outset
,
&
errset
,
ptimeout
);
memcpy
(
inset
.
get
(),
&
_pollset_in
,
valid_pollset_bytes
(
_pollset_in
));
memcpy
(
outset
.
get
(),
&
_pollset_out
,
valid_pollset_bytes
(
_pollset_out
));
memcpy
(
errset
.
get
(),
&
_pollset_err
,
valid_pollset_bytes
(
_pollset_err
));
const
int
rc
=
select
(
static_cast
<
int
>
(
_max_fd
+
1
),
inset
.
get
(),
outset
.
get
(),
errset
.
get
(),
ptimeout
);
#if defined ZMQ_HAVE_WINDOWS
if
(
unlikely
(
rc
==
SOCKET_ERROR
))
{
errno
=
wsa_error_to_errno
(
WSAGetLastError
());
...
...
@@ -662,8 +667,8 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_,
_signaler
->
recv
();
// Check for the events.
const
int
found
=
check_events
(
events_
,
n_events_
,
inset
,
outset
,
errset
);
const
int
found
=
check_events
(
events_
,
n_events_
,
*
inset
.
get
(),
*
outset
.
get
(),
*
errset
.
get
()
);
if
(
found
)
{
if
(
found
>
0
)
zero_trail_events
(
events_
,
n_events_
,
found
);
...
...
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