diff --git a/src/no_runner.ml b/src/immediate_runner.ml similarity index 100% rename from src/no_runner.ml rename to src/immediate_runner.ml diff --git a/src/immediate_runner.mli b/src/immediate_runner.mli new file mode 100644 index 00000000..ed017eba --- /dev/null +++ b/src/immediate_runner.mli @@ -0,0 +1,20 @@ +(** Runner that runs tasks immediately in the caller thread. + + Whenever a task is submitted to this runner via [Runner.run_async r task], + the task is run immediately in the caller thread as [task()]. + There are no background threads, no resource, this is just a trivial + implementation of the interface. + + This can be useful when an implementation needs a runner, but there isn't + enough work to justify starting an actual full thread pool. + + Another situation is when threads cannot be used at all (e.g. because you + plan to call [Unix.fork] later). + + @since NEXT_RELEASE +*) + +include module type of Runner + +val runner : t +(** The trivial runner that actually runs tasks at the calling point. *) diff --git a/src/moonpool.ml b/src/moonpool.ml index 498a9fb3..cb82f668 100644 --- a/src/moonpool.ml +++ b/src/moonpool.ml @@ -13,7 +13,7 @@ module Fifo_pool = Fifo_pool module Fork_join = Fork_join module Fut = Fut module Lock = Lock -module No_runner = No_runner +module Immediate_runner = Immediate_runner module Pool = Fifo_pool module Runner = Runner module Thread_local_storage = Thread_local_storage diff --git a/src/moonpool.mli b/src/moonpool.mli index 05b8649c..40b78891 100644 --- a/src/moonpool.mli +++ b/src/moonpool.mli @@ -12,7 +12,7 @@ module Ws_pool = Ws_pool module Fifo_pool = Fifo_pool module Runner = Runner -module No_runner = No_runner +module Immediate_runner = Immediate_runner module Pool = Fifo_pool [@@deprecated "use Fifo_pool or Ws_pool to be more explicit"] diff --git a/src/no_runner.mli b/src/no_runner.mli deleted file mode 100644 index 2c295adc..00000000 --- a/src/no_runner.mli +++ /dev/null @@ -1,6 +0,0 @@ -(** Runner that runs in the caller, not in the background. *) - -include module type of Runner - -val runner : t -(** The trivial runner that actually runs tasks at the calling point. *)