mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Use LW_SHARED in dsa.c where possible.
Both dsa_get_total_size() and dsa_get_total_size_from_handle() take an exclusive lock just to read a variable. This commit reduces the lock level to LW_SHARED in those functions. Reviewed-by: Sami Imseih <samimseih@gmail.com> Discussion: https://postgr.es/m/aS8fMzWs9e8iHxk2%40nathan
This commit is contained in:
parent
cbe04e5d72
commit
a6d05c8193
1 changed files with 2 additions and 2 deletions
|
|
@ -1043,7 +1043,7 @@ dsa_get_total_size(dsa_area *area)
|
|||
{
|
||||
size_t size;
|
||||
|
||||
LWLockAcquire(DSA_AREA_LOCK(area), LW_EXCLUSIVE);
|
||||
LWLockAcquire(DSA_AREA_LOCK(area), LW_SHARED);
|
||||
size = area->control->total_segment_size;
|
||||
LWLockRelease(DSA_AREA_LOCK(area));
|
||||
|
||||
|
|
@ -1075,7 +1075,7 @@ dsa_get_total_size_from_handle(dsa_handle handle)
|
|||
|
||||
control = (dsa_area_control *) dsm_segment_address(segment);
|
||||
|
||||
LWLockAcquire(&control->lock, LW_EXCLUSIVE);
|
||||
LWLockAcquire(&control->lock, LW_SHARED);
|
||||
size = control->total_segment_size;
|
||||
LWLockRelease(&control->lock);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue