Commit 26427209 authored by TousakaRin's avatar TousakaRin

Fix bug, constant_cl::current_concurrency not initialized in constructor

parent 6f096dca
...@@ -20,9 +20,9 @@ namespace brpc { ...@@ -20,9 +20,9 @@ namespace brpc {
namespace policy { namespace policy {
bool ConstantConcurrencyLimiter::OnRequested() { bool ConstantConcurrencyLimiter::OnRequested() {
const int32_t current_concurreny = const int32_t current_concurrency =
_current_concurrency.fetch_add(1, butil::memory_order_relaxed); _current_concurrency.fetch_add(1, butil::memory_order_relaxed);
if (_max_concurrency != 0 && current_concurreny >= _max_concurrency) { if (_max_concurrency != 0 && current_concurrency >= _max_concurrency) {
return false; return false;
} }
return true; return true;
......
...@@ -24,7 +24,7 @@ namespace policy { ...@@ -24,7 +24,7 @@ namespace policy {
class ConstantConcurrencyLimiter : public ConcurrencyLimiter { class ConstantConcurrencyLimiter : public ConcurrencyLimiter {
public: public:
ConstantConcurrencyLimiter() {} ConstantConcurrencyLimiter() : _current_concurrency(0) {}
~ConstantConcurrencyLimiter() {} ~ConstantConcurrencyLimiter() {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment