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

Commit278584b

Browse files
committed
Remove volatile from latch API
This was no longer useful since the latch functions use memorybarriers already, which are also compiler barriers, and volatile doesnot help with cross-process access.Discussion:https://www.postgresql.org/message-id/flat/20190218202511.qsfpuj5sy4dbezcw%40alap3.anarazel.de#18783c27d73e9e40009c82f6e0df0974
1 parent754b90f commit278584b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

‎src/backend/storage/ipc/latch.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ InitializeLatchSupport(void)
225225
* Initialize a process-local latch.
226226
*/
227227
void
228-
InitLatch(volatileLatch*latch)
228+
InitLatch(Latch*latch)
229229
{
230230
latch->is_set= false;
231231
latch->owner_pid=MyProcPid;
@@ -257,7 +257,7 @@ InitLatch(volatile Latch *latch)
257257
* process references to postmaster-private latches or WaitEventSets.
258258
*/
259259
void
260-
InitSharedLatch(volatileLatch*latch)
260+
InitSharedLatch(Latch*latch)
261261
{
262262
#ifdefWIN32
263263
SECURITY_ATTRIBUTESsa;
@@ -293,7 +293,7 @@ InitSharedLatch(volatile Latch *latch)
293293
* as shared latches use SIGUSR1 for inter-process communication.
294294
*/
295295
void
296-
OwnLatch(volatileLatch*latch)
296+
OwnLatch(Latch*latch)
297297
{
298298
/* Sanity checks */
299299
Assert(latch->is_shared);
@@ -313,7 +313,7 @@ OwnLatch(volatile Latch *latch)
313313
* Disown a shared latch currently owned by the current process.
314314
*/
315315
void
316-
DisownLatch(volatileLatch*latch)
316+
DisownLatch(Latch*latch)
317317
{
318318
Assert(latch->is_shared);
319319
Assert(latch->owner_pid==MyProcPid);
@@ -341,7 +341,7 @@ DisownLatch(volatile Latch *latch)
341341
* we return all of them in one call, but we will return at least one.
342342
*/
343343
int
344-
WaitLatch(volatileLatch*latch,intwakeEvents,longtimeout,
344+
WaitLatch(Latch*latch,intwakeEvents,longtimeout,
345345
uint32wait_event_info)
346346
{
347347
returnWaitLatchOrSocket(latch,wakeEvents,PGINVALID_SOCKET,timeout,
@@ -366,7 +366,7 @@ WaitLatch(volatile Latch *latch, int wakeEvents, long timeout,
366366
* WaitEventSet instead; that's more efficient.
367367
*/
368368
int
369-
WaitLatchOrSocket(volatileLatch*latch,intwakeEvents,pgsocketsock,
369+
WaitLatchOrSocket(Latch*latch,intwakeEvents,pgsocketsock,
370370
longtimeout,uint32wait_event_info)
371371
{
372372
intret=0;
@@ -381,7 +381,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
381381

382382
if (wakeEvents&WL_LATCH_SET)
383383
AddWaitEventToSet(set,WL_LATCH_SET,PGINVALID_SOCKET,
384-
(Latch*)latch,NULL);
384+
latch,NULL);
385385

386386
/* Postmaster-managed callers must handle postmaster death somehow. */
387387
Assert(!IsUnderPostmaster||
@@ -433,7 +433,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
433433
* throwing an error is not a good idea.
434434
*/
435435
void
436-
SetLatch(volatileLatch*latch)
436+
SetLatch(Latch*latch)
437437
{
438438
#ifndefWIN32
439439
pid_towner_pid;
@@ -516,7 +516,7 @@ SetLatch(volatile Latch *latch)
516516
* the latch is set again before the WaitLatch call.
517517
*/
518518
void
519-
ResetLatch(volatileLatch*latch)
519+
ResetLatch(Latch*latch)
520520
{
521521
/* Only the owner should reset the latch */
522522
Assert(latch->owner_pid==MyProcPid);

‎src/include/storage/latch.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ typedef struct WaitEventSet WaitEventSet;
156156
* prototypes for functions in latch.c
157157
*/
158158
externvoidInitializeLatchSupport(void);
159-
externvoidInitLatch(volatileLatch*latch);
160-
externvoidInitSharedLatch(volatileLatch*latch);
161-
externvoidOwnLatch(volatileLatch*latch);
162-
externvoidDisownLatch(volatileLatch*latch);
163-
externvoidSetLatch(volatileLatch*latch);
164-
externvoidResetLatch(volatileLatch*latch);
159+
externvoidInitLatch(Latch*latch);
160+
externvoidInitSharedLatch(Latch*latch);
161+
externvoidOwnLatch(Latch*latch);
162+
externvoidDisownLatch(Latch*latch);
163+
externvoidSetLatch(Latch*latch);
164+
externvoidResetLatch(Latch*latch);
165165

166166
externWaitEventSet*CreateWaitEventSet(MemoryContextcontext,intnevents);
167167
externvoidFreeWaitEventSet(WaitEventSet*set);
@@ -172,9 +172,9 @@ extern void ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *la
172172
externintWaitEventSetWait(WaitEventSet*set,longtimeout,
173173
WaitEvent*occurred_events,intnevents,
174174
uint32wait_event_info);
175-
externintWaitLatch(volatileLatch*latch,intwakeEvents,longtimeout,
175+
externintWaitLatch(Latch*latch,intwakeEvents,longtimeout,
176176
uint32wait_event_info);
177-
externintWaitLatchOrSocket(volatileLatch*latch,intwakeEvents,
177+
externintWaitLatchOrSocket(Latch*latch,intwakeEvents,
178178
pgsocketsock,longtimeout,uint32wait_event_info);
179179

180180
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp