@@ -20,13 +20,13 @@ static void BgwMainLoop(Datum arg)
2020 PGSemaphoreLock (& pool -> available );
2121 SpinLockAcquire (& pool -> lock );
2222 Assert (pool -> head != pool -> tail );
23- size = (int * )& pool -> buf [pool -> head ];
23+ size = (int * )& pool -> queue [pool -> head ];
2424 void * work = palloc (len );
2525 if (pool -> head + size + 4 > pool -> size ) {
26- memcpy (work , pool -> buf , size );
26+ memcpy (work , pool -> queue , size );
2727 pool -> head = (size & 3 ) & ~3 ;
2828 } else {
29- memcpy (work , & pool -> buf [pool -> head + 4 ], size );
29+ memcpy (work , & pool -> queue [pool -> head + 4 ], size );
3030 pool -> head += 4 + ((size & 3 ) & ~3 );
3131 }
3232 if (pool -> size == pool -> head ) {
@@ -42,11 +42,11 @@ static void BgwMainLoop(Datum arg)
4242 }
4343}
4444
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 );
4646{
4747 int i ;
4848 BackgroundWorker worker ;
49- BGWPool * pool = (BGWPool * )ShmemAlloc (bufSize + sizeof (BGWPool ));
49+ BGWPool * pool = (BGWPool * )ShmemAlloc (queueSize + sizeof (BGWPool ));
5050 pool -> executor = executor ;
5151 PGSemaphoreCreate (& pool -> available );
5252 PGSemaphoreCreate (& pool -> overflow );
@@ -56,7 +56,7 @@ BGWPool* BgwPoolCreate(BgwExecutor executor, char const* dbname, size_t bufSize,
5656 pool -> producerBlocked = false;
5757 pool -> head = 0 ;
5858 pool -> tail = 0 ;
59- pool -> size = bufSize ;
59+ pool -> size = queueSize ;
6060 strcpy (pool -> dbname , dbname );
6161
6262 MemSet (& worker , 0 , sizeof (BackgroundWorker ));
@@ -90,12 +90,12 @@ void BgwPoolExecute(BgwPool* pool, void* work, size_t size);
9090 PGSemaphoreLock (& pool -> overflow );
9191 SpinLockAcquire (& pool -> lock );
9292 } else {
93- * (int * )& pool -> buf [pool -> tail ] = size ;
93+ * (int * )& pool -> queue [pool -> tail ] = size ;
9494 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 );
9696 pool -> tail += 4 + (size + 3 ) & ~3 ;
9797 } else {
98- memcpy (pool -> buf , work , size );
98+ memcpy (pool -> queue , work , size );
9999 pool -> tail = (size + 3 ) & ~3 ;
100100 }
101101 PGSemaphoreUnlock (& pool -> available );
0 commit comments