[][src]Function constellation::try_spawn

pub async fn try_spawn<T: FnOnce(Pid) + Serialize + DeserializeOwned>(
    resources: Resources,
    start: T
) -> Result<Pid, TrySpawnError>

Spawn a new process if it can be allocated immediately.

try_spawn() takes 2 arguments:

  • resources: memory and CPU resource requirements of the new process
  • start: the closure to be run in the new process

try_spawn() on success returns the Pid of the new process.