12345678910111213141516171819202122232425262728open!Coreopen!Async_kernelopen!ImportincludeWeak_hashtblletcreate?growth_allowed?sizehashable=lett=create?growth_allowed?sizehashablein(* To avoid having keys around that should be cleaned, we must ensure that after any
call to [thread_safe_f], there is a call to
[reclaim_space_for_keys_with_unused_data]. We do this via [reclaim_will_happen],
which, if [true], guarantees that a call to [reclaim_space_for_keys_with_unused_data]
will happen in the future. It is OK if we have multiple reclaims extant
simultaneously, since they are async jobs. *)letreclaim_will_happen=reffalseinletreclaim()=reclaim_will_happen:=false;reclaim_space_for_keys_with_unused_datatinset_run_when_unused_datat~thread_safe_f:(fun()->ifnot!reclaim_will_happenthen(reclaim_will_happen:=true;Async_kernel_scheduler.thread_safe_enqueue_jobExecution_context.mainreclaim()));t;;letreclaim_space_for_keys_with_unused_data`Do_not_use=assertfalseletset_run_when_unused_data`Do_not_use=assertfalse