40 static std::shared_ptr<RateLimiter> mRateLimiterInstance;
41 static std::mutex instanceProtectionLock;
42 std::shared_timed_mutex mRateLimiterMutex;
45 double mPenaltyFactor;
47 int8_t shouldBeProcessed(int32_t clientPID);
76 static std::shared_ptr<RateLimiter> getInstance() {
77 if(mRateLimiterInstance ==
nullptr) {
78 instanceProtectionLock.lock();
79 if(mRateLimiterInstance ==
nullptr) {
81 mRateLimiterInstance = std::shared_ptr<RateLimiter> (
new RateLimiter());
82 }
catch(
const std::bad_alloc& e) {
83 instanceProtectionLock.unlock();
87 instanceProtectionLock.unlock();
89 return mRateLimiterInstance;