Skip to content

Commit 64ee33e

Browse files
committed
client: make gc step non-static
All connections has GC of input buffer, and step counter is static now. It breaks multithreaded scenarios since several connections can be use concurrently from several threads, so let's move the GC step counter right to `Connection` class. Part of #110
1 parent edc0c4f commit 64ee33e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Client/Connection.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ class Connection
250250
private:
251251
ConnectionImpl<BUFFER, NetProvider> *impl;
252252
static constexpr size_t GC_STEP_CNT = 100;
253+
size_t gc_step = 0;
253254

254255
template <class T>
255256
rid_t insert(const T &tuple, uint32_t space_id);
@@ -521,8 +522,7 @@ template<class BUFFER, class NetProvider>
521522
static void
522523
inputBufGC(Connection<BUFFER, NetProvider> &conn)
523524
{
524-
static int gc_step = 0;
525-
if ((gc_step++ % Connection<BUFFER, NetProvider>::GC_STEP_CNT) == 0) {
525+
if ((conn.gc_step++ % Connection<BUFFER, NetProvider>::GC_STEP_CNT) == 0) {
526526
LOG_DEBUG("Flushed input buffer of the connection %p", &conn);
527527
conn.impl->inBuf.flush();
528528
}

0 commit comments

Comments
 (0)