Module Ecaml.Background

A background job is an Async job that the emacs UI is not blocking on. These jobs are special -- they can only interact with the UI in limited ways to avoid interfering with blocking jobs, or with the user. For example, background jobs may not change the current buffer.

val don't_wait_for : Core_kernel.Source_code_position.t -> (unit -> unit Async.Deferred.t) -> unit

don't_wait_for here f is like Async.don't_wait_for, except that it marks all jobs created by running f as background jobs.

module Clock : sig ... end
val assert_foreground : ?⁠message:Async.Sexp.t -> Core_kernel.Source_code_position.t -> unit

If this is called in a background Async job, raise an exception.

val currently_running_in_background : unit -> Core_kernel.Source_code_position.t option

Return Some location when the current Async job is a background job. location is the Source_code_position.t describing where the job was originally tagged as running in the background.

val am_running_in_background : unit -> bool
val am_running_in_foreground : unit -> bool
val run_in_background : Core_kernel.Source_code_position.t -> f:(unit -> 'a) -> 'a