@@ -669,11 +669,14 @@ static bool cfs_gc_file(char* map_path, bool background)
669
669
pg_atomic_fetch_sub_u32 (& cfs_state -> n_active_gc , 1 );
670
670
671
671
rc = WaitLatch (MyLatch ,
672
- WL_TIMEOUT | WL_POSTMASTER_DEATH ,
672
+ WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH ,
673
673
CFS_DISABLE_TIMEOUT /* ms */ );
674
674
if (cfs_gc_stop || (rc & WL_POSTMASTER_DEATH ))
675
675
exit (1 );
676
676
677
+ CHECK_FOR_INTERRUPTS ();
678
+ ResetLatch (MyLatch );
679
+
677
680
pg_atomic_fetch_add_u32 (& cfs_state -> n_active_gc , 1 );
678
681
}
679
682
@@ -1014,10 +1017,13 @@ static bool cfs_gc_file(char* map_path, bool background)
1014
1017
if (cfs_gc_delay != 0 )
1015
1018
{
1016
1019
int rc = WaitLatch (MyLatch ,
1017
- WL_TIMEOUT | WL_POSTMASTER_DEATH ,
1020
+ WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH ,
1018
1021
cfs_gc_delay /* ms */ );
1019
1022
if (rc & WL_POSTMASTER_DEATH )
1020
1023
exit (1 );
1024
+
1025
+ CHECK_FOR_INTERRUPTS ();
1026
+ ResetLatch (MyLatch );
1021
1027
}
1022
1028
}
1023
1029
else if (cfs_state -> max_iterations == 1 )
@@ -1134,10 +1140,13 @@ static void cfs_gc_bgworker_main(Datum arg)
1134
1140
break ;
1135
1141
}
1136
1142
rc = WaitLatch (MyLatch ,
1137
- WL_TIMEOUT | WL_POSTMASTER_DEATH ,
1143
+ WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH ,
1138
1144
timeout /* ms */ );
1139
1145
if (rc & WL_POSTMASTER_DEATH )
1140
1146
exit (1 );
1147
+
1148
+ CHECK_FOR_INTERRUPTS ();
1149
+ ResetLatch (MyLatch );
1141
1150
}
1142
1151
}
1143
1152
@@ -1176,10 +1185,13 @@ bool cfs_control_gc(bool enabled)
1176
1185
while (pg_atomic_read_u32 (& cfs_state -> n_active_gc ) != 0 )
1177
1186
{
1178
1187
int rc = WaitLatch (MyLatch ,
1179
- WL_TIMEOUT | WL_POSTMASTER_DEATH ,
1188
+ WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH ,
1180
1189
CFS_DISABLE_TIMEOUT /* ms */ );
1181
1190
if (rc & WL_POSTMASTER_DEATH )
1182
1191
exit (1 );
1192
+
1193
+ CHECK_FOR_INTERRUPTS ();
1194
+ ResetLatch (MyLatch );
1183
1195
}
1184
1196
}
1185
1197
return was_enabled ;
0 commit comments