+sub _run { # with_umask callback
+ my ($ibx, $cb, $opt) = @_;
+ my $im = $ibx->can('importer') ? $ibx->importer(0) : undef;
+ ($im // $ibx)->lock_acquire;
+ my ($tmp, $queue) = prepare_run($ibx, $opt);
+
+ # fine-grained locking if we prepare for reindex
+ if (!$opt->{-coarse_lock}) {
+ prepare_reindex($ibx, $opt);
+ ($im // $ibx)->lock_release;
+ }
+
+ $ibx->cleanup if $ibx->can('cleanup');
+ process_queue($queue, $cb, $opt);
+ ($im // $ibx)->lock_acquire if !$opt->{-coarse_lock};
+ commit_changes($ibx, $im, $tmp, $opt);
+}
+