procspawn
This crate provides the ability to spawn processes with a function similar
to thread::spawn. Instead of closures it passes serde
serializable objects. The return value from the spawned closure also must be
serializable and can then be retrieved from the returned join handle.
If the spawned function causes a panic it will also be serialized across the process boundaries.
Example
Step 1: invoke procspawn::init as the first operation in main. A spawned
process starts the executable again and re-enters main, so any code before
this call runs again in every child process. Keep application setup and other
side effects after it.
Step 2: now you can start spawning functions:
let data = vec!;
let handle = spawn;
let result = handle.join.unwrap;
License and Links
- Documentation
- Issue Tracker
- Examples
- License: Apache-2.0