File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class EventLoopThreadPool : public Status {
34
34
int idx = 0 ;
35
35
if (lb == LB_RoundRobin) {
36
36
if (++next_loop_idx_ >= numLoops) next_loop_idx_ = 0 ;
37
- idx = next_loop_idx_. fetch_and ( numLoops) ;
37
+ idx = next_loop_idx_ % numLoops;
38
38
} else if (lb == LB_Random) {
39
39
idx = hv_rand (0 , numLoops - 1 );
40
40
} else if (lb == LB_LeastConnections) {
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ static hloop_t** worker_loops = NULL;
19
19
20
20
static hloop_t * get_next_loop () {
21
21
static int s_cur_index = 0 ;
22
- if (s_cur_index = = thread_num ) {
22
+ if (++ s_cur_index > = thread_num ) {
23
23
s_cur_index = 0 ;
24
24
}
25
- return worker_loops [s_cur_index ++ ];
25
+ return worker_loops [s_cur_index % thread_num ];
26
26
}
27
27
28
28
static void on_close (hio_t * io ) {
You can’t perform that action at this time.
0 commit comments