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
cd7300fd
Commit
cd7300fd
authored
Feb 12, 2010
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve command starvation in recv()
parent
7f7ac843
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
socket_base.cpp
src/socket_base.cpp
+18
-18
No files found.
src/socket_base.cpp
View file @
cd7300fd
...
@@ -327,8 +327,23 @@ int zmq::socket_base_t::flush ()
...
@@ -327,8 +327,23 @@ int zmq::socket_base_t::flush ()
int
zmq
::
socket_base_t
::
recv
(
::
zmq_msg_t
*
msg_
,
int
flags_
)
int
zmq
::
socket_base_t
::
recv
(
::
zmq_msg_t
*
msg_
,
int
flags_
)
{
{
// Get the message
and return immediately if successfull
.
// Get the message.
int
rc
=
xrecv
(
msg_
,
flags_
);
int
rc
=
xrecv
(
msg_
,
flags_
);
// Once every inbound_poll_rate messages check for signals and process
// incoming commands. This happens only if we are not polling altogether
// because there are messages available all the time. If poll occurs,
// ticks is set to zero and thus we avoid this code.
//
// Note that 'recv' uses different command throttling algorithm (the one
// described above) from the one used by 'send'. This is because counting
// ticks is more efficient than doing rdtsc all the time.
if
(
++
ticks
==
inbound_poll_rate
)
{
app_thread
->
process_commands
(
false
,
false
);
ticks
=
0
;
}
// If we have the message, return immediately.
if
(
rc
==
0
)
if
(
rc
==
0
)
return
0
;
return
0
;
...
@@ -346,27 +361,12 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
...
@@ -346,27 +361,12 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
}
}
else
{
else
{
while
(
rc
!=
0
)
{
while
(
rc
!=
0
)
{
if
(
errno
==
EAGAIN
)
if
(
errno
!=
EAGAIN
)
app_thread
->
process_commands
(
true
,
false
);
else
return
-
1
;
return
-
1
;
app_thread
->
process_commands
(
true
,
false
);
rc
=
xrecv
(
msg_
,
flags_
);
rc
=
xrecv
(
msg_
,
flags_
);
}
ticks
=
0
;
ticks
=
0
;
}
}
// Once every inbound_poll_rate messages check for signals and process
// incoming commands. This happens only if we are not polling altogether
// because there are messages available all the time. If poll occurs,
// ticks is set to zero and thus we avoid this code.
//
// Note that 'recv' uses different command throttling algorithm (the one
// described above) from the one used by 'send'. This is because counting
// ticks is more efficient than doing rdtsc all the time.
if
(
++
ticks
==
inbound_poll_rate
)
{
app_thread
->
process_commands
(
false
,
false
);
ticks
=
0
;
}
}
return
rc
;
return
rc
;
...
...
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