MCPcopy Create free account
hub / github.com/Tencent/phxsql / Refill

Method Refill

phxsqlclient/utils/leakybucket.cpp:118–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118int MmapLeakyBucket::Refill(int iBucketSize) {
119 if (NULL == m_poLock || NULL == m_ptBucket)
120 return -1;
121
122 m_poLock->WriteLockW(0);
123
124 m_tConfig.iBucketSize = iBucketSize;
125
126 unsigned int tLatestRefillTime = (unsigned int) time(NULL);
127 m_ptBucket->tLatestRefillTime = tLatestRefillTime;
128 m_ptBucket->iTokenCount = m_tConfig.iBucketSize;
129
130 m_poLock->Unlock(0);
131 return 0;
132}
133
134bool MmapLeakyBucket::HasToken() {
135 if (NULL == m_poLock || NULL == m_ptBucket)

Callers

nothing calls this directly

Calls 2

WriteLockWMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected