summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author刘畅 <[email protected]>2024-03-25 06:40:36 +0000
committer刘畅 <[email protected]>2024-03-25 06:40:36 +0000
commit2d8e693acbfa5497721cfeb53e93e5382d85ea28 (patch)
treed61fb653bc634285433d67e7501a363ea80371b7
parent939e2df3492a035e4b979f30dffdc87e81af2bc6 (diff)
parent4df508e0ec9757964b6bf83a73dd4c727b1b66b1 (diff)
Merge branch 'bugfix_static_arg_thread_local' into 'rel'v3.1.26
避免多线程读写冲突,将static变量声明为thread_local See merge request tango/shaping-engine!84
-rw-r--r--shaping/src/shaper.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/shaping/src/shaper.cpp b/shaping/src/shaper.cpp
index 0cd73a6..09e2b28 100644
--- a/shaping/src/shaper.cpp
+++ b/shaping/src/shaper.cpp
@@ -1176,8 +1176,8 @@ END:
void polling_entry(struct shaper *sp, struct shaping_stat *stat, struct shaping_thread_ctx *ctx)
{
- static int swarmkv_caller_loop_divisor = SWARMKV_CALLER_LOOP_DIVISOR_MIN;
- static unsigned int polling_cnt = 0;
+ static thread_local int swarmkv_caller_loop_divisor = SWARMKV_CALLER_LOOP_DIVISOR_MIN;
+ static thread_local unsigned int polling_cnt = 0;
polling_cnt++;
if (polling_cnt % swarmkv_caller_loop_divisor == 0) {