diff options
| author | root <[email protected]> | 2024-03-25 06:35:55 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-03-25 06:35:55 +0000 |
| commit | 4df508e0ec9757964b6bf83a73dd4c727b1b66b1 (patch) | |
| tree | d61fb653bc634285433d67e7501a363ea80371b7 /shaping/src/shaper.cpp | |
| parent | 939e2df3492a035e4b979f30dffdc87e81af2bc6 (diff) | |
TSG-20098: 避免多线程读写冲突,将static变量声明为thread_local
Diffstat (limited to 'shaping/src/shaper.cpp')
| -rw-r--r-- | shaping/src/shaper.cpp | 4 |
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) { |
