@@ -20,13 +20,13 @@ static void BgwMainLoop(Datum arg)
20
20
PGSemaphoreLock (& pool -> available );
21
21
SpinLockAcquire (& pool -> lock );
22
22
Assert (pool -> head != pool -> tail );
23
- size = (int * )& pool -> buf [pool -> head ];
23
+ size = (int * )& pool -> queue [pool -> head ];
24
24
void * work = palloc (len );
25
25
if (pool -> head + size + 4 > pool -> size ) {
26
- memcpy (work , pool -> buf , size );
26
+ memcpy (work , pool -> queue , size );
27
27
pool -> head = (size & 3 ) & ~3 ;
28
28
} else {
29
- memcpy (work , & pool -> buf [pool -> head + 4 ], size );
29
+ memcpy (work , & pool -> queue [pool -> head + 4 ], size );
30
30
pool -> head += 4 + ((size & 3 ) & ~3 );
31
31
}
32
32
if (pool -> size == pool -> head ) {
@@ -42,11 +42,11 @@ static void BgwMainLoop(Datum arg)
42
42
}
43
43
}
44
44
45
- BGWPool * BgwPoolCreate (BgwExecutor executor , char const * dbname , size_t bufSize , size_t nWorkers );
45
+ BGWPool * BgwPoolCreate (BgwExecutor executor , char const * dbname , size_t queueSize , size_t nWorkers );
46
46
{
47
47
int i ;
48
48
BackgroundWorker worker ;
49
- BGWPool * pool = (BGWPool * )ShmemAlloc (bufSize + sizeof (BGWPool ));
49
+ BGWPool * pool = (BGWPool * )ShmemAlloc (queueSize + sizeof (BGWPool ));
50
50
pool -> executor = executor ;
51
51
PGSemaphoreCreate (& pool -> available );
52
52
PGSemaphoreCreate (& pool -> overflow );
@@ -56,7 +56,7 @@ BGWPool* BgwPoolCreate(BgwExecutor executor, char const* dbname, size_t bufSize,
56
56
pool -> producerBlocked = false;
57
57
pool -> head = 0 ;
58
58
pool -> tail = 0 ;
59
- pool -> size = bufSize ;
59
+ pool -> size = queueSize ;
60
60
strcpy (pool -> dbname , dbname );
61
61
62
62
MemSet (& worker , 0 , sizeof (BackgroundWorker ));
@@ -90,12 +90,12 @@ void BgwPoolExecute(BgwPool* pool, void* work, size_t size);
90
90
PGSemaphoreLock (& pool -> overflow );
91
91
SpinLockAcquire (& pool -> lock );
92
92
} else {
93
- * (int * )& pool -> buf [pool -> tail ] = size ;
93
+ * (int * )& pool -> queue [pool -> tail ] = size ;
94
94
if (pool -> size - pool -> tail >= size + 4 ) {
95
- memcpy (& pool -> buf [pool -> tail + 4 ], work , size );
95
+ memcpy (& pool -> queue [pool -> tail + 4 ], work , size );
96
96
pool -> tail += 4 + (size + 3 ) & ~3 ;
97
97
} else {
98
- memcpy (pool -> buf , work , size );
98
+ memcpy (pool -> queue , work , size );
99
99
pool -> tail = (size + 3 ) & ~3 ;
100
100
}
101
101
PGSemaphoreUnlock (& pool -> available );
0 commit comments