mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-24 00:59:02 -05:00
Threaded IO: use main thread to handle read work
This commit is contained in:
parent
8b33975944
commit
1398fac3f1
@ -2755,7 +2755,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++;
|
||||||
}
|
}
|
||||||
@ -2768,6 +2768,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;
|
||||||
|
Loading…
Reference in New Issue
Block a user