@@ -669,11 +669,14 @@ static bool cfs_gc_file(char* map_path, bool background)
669669pg_atomic_fetch_sub_u32 (& cfs_state -> n_active_gc ,1 );
670670
671671rc = WaitLatch (MyLatch ,
672- WL_TIMEOUT |WL_POSTMASTER_DEATH ,
672+ WL_LATCH_SET | WL_TIMEOUT |WL_POSTMASTER_DEATH ,
673673CFS_DISABLE_TIMEOUT /* ms */ );
674674if (cfs_gc_stop || (rc & WL_POSTMASTER_DEATH ))
675675exit (1 );
676676
677+ CHECK_FOR_INTERRUPTS ();
678+ ResetLatch (MyLatch );
679+
677680pg_atomic_fetch_add_u32 (& cfs_state -> n_active_gc ,1 );
678681}
679682
@@ -1014,10 +1017,13 @@ static bool cfs_gc_file(char* map_path, bool background)
10141017if (cfs_gc_delay != 0 )
10151018{
10161019int rc = WaitLatch (MyLatch ,
1017- WL_TIMEOUT |WL_POSTMASTER_DEATH ,
1020+ WL_LATCH_SET | WL_TIMEOUT |WL_POSTMASTER_DEATH ,
10181021cfs_gc_delay /* ms */ );
10191022if (rc & WL_POSTMASTER_DEATH )
10201023exit (1 );
1024+
1025+ CHECK_FOR_INTERRUPTS ();
1026+ ResetLatch (MyLatch );
10211027}
10221028}
10231029else if (cfs_state -> max_iterations == 1 )
@@ -1134,10 +1140,13 @@ static void cfs_gc_bgworker_main(Datum arg)
11341140break ;
11351141}
11361142rc = WaitLatch (MyLatch ,
1137- WL_TIMEOUT |WL_POSTMASTER_DEATH ,
1143+ WL_LATCH_SET | WL_TIMEOUT |WL_POSTMASTER_DEATH ,
11381144timeout /* ms */ );
11391145if (rc & WL_POSTMASTER_DEATH )
11401146exit (1 );
1147+
1148+ CHECK_FOR_INTERRUPTS ();
1149+ ResetLatch (MyLatch );
11411150}
11421151}
11431152
@@ -1176,10 +1185,13 @@ bool cfs_control_gc(bool enabled)
11761185while (pg_atomic_read_u32 (& cfs_state -> n_active_gc )!= 0 )
11771186{
11781187int rc = WaitLatch (MyLatch ,
1179- WL_TIMEOUT |WL_POSTMASTER_DEATH ,
1188+ WL_LATCH_SET | WL_TIMEOUT |WL_POSTMASTER_DEATH ,
11801189CFS_DISABLE_TIMEOUT /* ms */ );
11811190if (rc & WL_POSTMASTER_DEATH )
11821191exit (1 );
1192+
1193+ CHECK_FOR_INTERRUPTS ();
1194+ ResetLatch (MyLatch );
11831195}
11841196}
11851197return was_enabled ;