package domainpc

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module DomainpcSource

Sourceval wait_on_unavailable : unit -> unit

wait_on_unavailable () when all cores are used and more are requested, wait for cores to be freed instead of crashing.

Sourceval get_available_cores : unit -> int

get_available_cores () returns the number of available cores.

Sourceval isolate_current : unit -> unit

isolate_current () ensures that the current domain (usually the main one) is restricted to run on a core where other isolated domains can't run.

Sourceval spawn : ?isolated:bool -> (unit -> 'a) -> 'a Domain.t

spawn ?isolated f if isolated is true spawns a domain that runs on a given core, otherwise behaves as Domain.spawn.

isolated is true by default.

  • raises Failure

    if spawn is called multiple times (or both spawn and spawn_n are called) with different values of isolated.

Sourceval spawn_n : ?isolated:bool -> ?n:int -> (unit -> 'a) -> 'a Domain.t array

spawn_n ?isolated ?n f if isolated is true, n is provided and is less than or equal to the number of free physical cores, spawns n new domains. If n is not provided and there is at least one free physical core, spawns as many domains as there are physical cores.

If isolated is false, the spawned domains are not guaranteed to run on separate cores.

isolated is true by default.

  • raises Failure

    if there aren't enough free physical cores.

  • raises Failure

    if spawn_n is called multiple times (or both spawn and spawn_n are called) with different values of isolated.

Sourcemodule Domain : sig ... end