mirror of
https://github.com/postgres/postgres.git
synced 2025-08-17 01:02:17 +03:00
Remove volatile qualifiers from dynahash.c, shmem.c, and sinvaladt.c
Prior to commit 0709b7ee72
, access to
variables within a spinlock-protected critical section had to be done
through a volatile pointer, but that should no longer be necessary.
Thomas Munro
This commit is contained in:
@@ -170,29 +170,26 @@ ShmemAlloc(Size size)
|
||||
Size newFree;
|
||||
void *newSpace;
|
||||
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile PGShmemHeader *shmemseghdr = ShmemSegHdr;
|
||||
|
||||
/*
|
||||
* ensure all space is adequately aligned.
|
||||
*/
|
||||
size = MAXALIGN(size);
|
||||
|
||||
Assert(shmemseghdr != NULL);
|
||||
Assert(ShmemSegHdr != NULL);
|
||||
|
||||
SpinLockAcquire(ShmemLock);
|
||||
|
||||
newStart = shmemseghdr->freeoffset;
|
||||
newStart = ShmemSegHdr->freeoffset;
|
||||
|
||||
/* extra alignment for large requests, since they are probably buffers */
|
||||
if (size >= BLCKSZ)
|
||||
newStart = BUFFERALIGN(newStart);
|
||||
|
||||
newFree = newStart + size;
|
||||
if (newFree <= shmemseghdr->totalsize)
|
||||
if (newFree <= ShmemSegHdr->totalsize)
|
||||
{
|
||||
newSpace = (void *) ((char *) ShmemBase + newStart);
|
||||
shmemseghdr->freeoffset = newFree;
|
||||
ShmemSegHdr->freeoffset = newFree;
|
||||
}
|
||||
else
|
||||
newSpace = NULL;
|
||||
|
Reference in New Issue
Block a user