Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b3ff8a4b
Commit
b3ff8a4b
authored
May 21, 2019
by
zhaozhao.zz
Committed by
antirez
Jan 17, 2020
Browse files
Threaded IO: use main thread to handle read work
parent
b1f2c510
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
b3ff8a4b
...
@@ -2885,7 +2885,7 @@ int handleClientsWithPendingReadsUsingThreads(void) {
...
@@ -2885,7 +2885,7 @@ int handleClientsWithPendingReadsUsingThreads(void) {
int item_id = 0;
int item_id = 0;
while((ln = listNext(&li))) {
while((ln = listNext(&li))) {
client *c = listNodeValue(ln);
client *c = listNodeValue(ln);
int target_id = item_id % server.io_threads_num;
int target_id = item_id %
(
server.io_threads_num
+1)
;
listAddNodeTail(io_threads_list[target_id],c);
listAddNodeTail(io_threads_list[target_id],c);
item_id++;
item_id++;
}
}
...
@@ -2898,6 +2898,13 @@ int handleClientsWithPendingReadsUsingThreads(void) {
...
@@ -2898,6 +2898,13 @@ int handleClientsWithPendingReadsUsingThreads(void) {
io_threads_pending[j] = count;
io_threads_pending[j] = count;
}
}
listRewind(io_threads_list[server.io_threads_num],&li);
while((ln = listNext(&li))) {
client *c = listNodeValue(ln);
readQueryFromClient(NULL,c->fd,c,0);
}
listEmpty(io_threads_list[server.io_threads_num]);
/* Wait for all threads to end their work. */
/* Wait for all threads to end their work. */
while(1) {
while(1) {
unsigned long pending = 0;
unsigned long pending = 0;
...
...
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