Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd03d754

Browse files
committed
Use macros instead of hardcoded offsets for LWLock initialization
This makes the code slightly easier to follow, as the initializationrelies on an offset that overlapped with an equivalent set of macrosdefined, which are used in other places already.Author: Japin LiDiscussion:https://postgr.es/m/MEYP282MB1669FB410006758402F2C3A2B6E00@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
1 parent789b938 commitd03d754

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/backend/storage/lmgr/lwlock.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,18 +525,17 @@ InitializeLWLocks(void)
525525
LWLockInitialize(&lock->lock,id);
526526

527527
/* Initialize buffer mapping LWLocks in main array */
528-
lock=MainLWLockArray+NUM_INDIVIDUAL_LWLOCKS;
528+
lock=MainLWLockArray+BUFFER_MAPPING_LWLOCK_OFFSET;
529529
for (id=0;id<NUM_BUFFER_PARTITIONS;id++,lock++)
530530
LWLockInitialize(&lock->lock,LWTRANCHE_BUFFER_MAPPING);
531531

532532
/* Initialize lmgrs' LWLocks in main array */
533-
lock=MainLWLockArray+NUM_INDIVIDUAL_LWLOCKS+NUM_BUFFER_PARTITIONS;
533+
lock=MainLWLockArray+LOCK_MANAGER_LWLOCK_OFFSET;
534534
for (id=0;id<NUM_LOCK_PARTITIONS;id++,lock++)
535535
LWLockInitialize(&lock->lock,LWTRANCHE_LOCK_MANAGER);
536536

537537
/* Initialize predicate lmgrs' LWLocks in main array */
538-
lock=MainLWLockArray+NUM_INDIVIDUAL_LWLOCKS+
539-
NUM_BUFFER_PARTITIONS+NUM_LOCK_PARTITIONS;
538+
lock=MainLWLockArray+PREDICATELOCK_MANAGER_LWLOCK_OFFSET;
540539
for (id=0;id<NUM_PREDICATELOCK_PARTITIONS;id++,lock++)
541540
LWLockInitialize(&lock->lock,LWTRANCHE_PREDICATE_LOCK_MANAGER);
542541

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp