Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
bdb338cf
Commit
bdb338cf
authored
Mar 15, 2020
by
antirez
Browse files
Aesthetic changes in PR #6989.
parent
b3e03054
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
bdb338cf
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
static void setProtocolError(const char *errstr, client *c);
static void setProtocolError(const char *errstr, client *c);
int postponeClientRead(client *c);
int postponeClientRead(client *c);
int
p
rocess
_w
hile
_b
locked
;
int
P
rocess
ingEventsW
hile
B
locked
= 0; /* See processEventsWhileBlocked(). */
/* Return the size consumed from the allocator, for the specified SDS string,
/* Return the size consumed from the allocator, for the specified SDS string,
* including internal fragmentation. This function is used in order to compute
* including internal fragmentation. This function is used in order to compute
...
@@ -2739,7 +2739,12 @@ int clientsArePaused(void) {
...
@@ -2739,7 +2739,12 @@ int clientsArePaused(void) {
int processEventsWhileBlocked(void) {
int processEventsWhileBlocked(void) {
int iterations = 4; /* See the function top-comment. */
int iterations = 4; /* See the function top-comment. */
int count = 0;
int count = 0;
process_while_blocked
=
1
;
/* Note: when we are processing events while blocked (for instance during
* busy Lua scripts), we set a global flag. When such flag is set, we
* avoid handling the read part of clients using threaded I/O.
* See https://github.com/antirez/redis/issues/6988 for more info. */
ProcessingEventsWhileBlocked = 1;
while (iterations--) {
while (iterations--) {
int events = 0;
int events = 0;
events += aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
events += aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT);
...
@@ -2747,7 +2752,7 @@ int processEventsWhileBlocked(void) {
...
@@ -2747,7 +2752,7 @@ int processEventsWhileBlocked(void) {
if (!events) break;
if (!events) break;
count += events;
count += events;
}
}
p
rocess
_w
hile
_b
locked
=
0
;
P
rocess
ingEventsW
hile
B
locked = 0;
return count;
return count;
}
}
...
@@ -2819,7 +2824,6 @@ void *IOThreadMain(void *myid) {
...
@@ -2819,7 +2824,6 @@ void *IOThreadMain(void *myid) {
/* Initialize the data structures needed for threaded I/O. */
/* Initialize the data structures needed for threaded I/O. */
void initThreadedIO(void) {
void initThreadedIO(void) {
io_threads_active = 0; /* We start with threads not active. */
io_threads_active = 0; /* We start with threads not active. */
process_while_blocked
=
0
;
/* Don't spawn any thread if the user selected a single thread:
/* Don't spawn any thread if the user selected a single thread:
* we'll handle I/O directly from the main thread. */
* we'll handle I/O directly from the main thread. */
...
@@ -2974,7 +2978,7 @@ int handleClientsWithPendingWritesUsingThreads(void) {
...
@@ -2974,7 +2978,7 @@ int handleClientsWithPendingWritesUsingThreads(void) {
int postponeClientRead(client *c) {
int postponeClientRead(client *c) {
if (io_threads_active &&
if (io_threads_active &&
server.io_threads_do_reads &&
server.io_threads_do_reads &&
!
p
rocess
_w
hile
_b
locked
&&
!
P
rocess
ingEventsW
hile
B
locked &&
!(c->flags & (CLIENT_MASTER|CLIENT_SLAVE|CLIENT_PENDING_READ)))
!(c->flags & (CLIENT_MASTER|CLIENT_SLAVE|CLIENT_PENDING_READ)))
{
{
c->flags |= CLIENT_PENDING_READ;
c->flags |= CLIENT_PENDING_READ;
...
...
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