Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LightProc Implementation #47

Merged
merged 39 commits into from Oct 24, 2019
Merged

LightProc Implementation #47

merged 39 commits into from Oct 24, 2019

Conversation

vertexclique
Copy link
Member

@vertexclique vertexclique commented Oct 15, 2019

Lightweight Process Abstraction for Rust
For design document please head to:
https://paper.dropbox.com/doc/lightproc-Lightweight-Process-Abstraction-for-Rust--AmtewIRcIeBypAqQEOn1c1wSAg-rHwfFjm2Ds17k6EtZai5Q

Features

Lifecycle callbacks

  • before_start
  • after complete
  • after panic

@xmclark I hope that is what you've wanted.

Proc PID

  • setting with a builder

Proc Stack

  • builder for proc stack

Examples

An example for panic recovery code, with a builder for the process stack it will be really clear. (without Some(Arc::new( mess).

    let (proc, handle) = LightProc::recoverable(
        future,
        schedule,
        ProcStack::default()
            .with_pid(1)
            .with_before_start(|| { println!("Before start"); })
            .with_after_complete(|| { println!("After complete"); })
            .with_after_panic(|| { println!("After panic"); })
    );

    let handle = spawn_on_thread(async {
        panic!("Panic here!");
    });

    executor::block_on(handle);

The output of that:

Before start
thread '<unnamed>' panicked at 'Panic here!', lightproc/examples/proc_panic.rs:64:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
After complete
After panic

@vertexclique vertexclique added this to In Progress in Project Board via automation Oct 15, 2019
@vertexclique vertexclique added the enhancement New feature or request label Oct 15, 2019
@vertexclique vertexclique self-assigned this Oct 15, 2019
@vertexclique vertexclique marked this pull request as ready for review October 24, 2019 19:12
lightproc/Cargo.toml Outdated Show resolved Hide resolved
lightproc/examples/proc_panic.rs Outdated Show resolved Hide resolved
lightproc/examples/proc_run.rs Outdated Show resolved Hide resolved
lightproc/src/lib.rs Outdated Show resolved Hide resolved
lightproc/src/lib.rs Show resolved Hide resolved
lightproc/examples/proc_panic.rs Outdated Show resolved Hide resolved
lightproc/examples/proc_run.rs Show resolved Hide resolved
lightproc/Cargo.toml Outdated Show resolved Hide resolved
lightproc/Cargo.toml Outdated Show resolved Hide resolved
lightproc/Cargo.toml Outdated Show resolved Hide resolved
vertexclique and others added 13 commits October 24, 2019 22:23
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
Co-Authored-By: Matthieu Le brazidec <matthieu@lebrazidec.email>
@vertexclique vertexclique merged commit d3636e3 into dev Oct 24, 2019
Project Board automation moved this from In Progress to Closed Oct 24, 2019
@vertexclique vertexclique deleted the lightproc branch October 24, 2019 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Project Board
  
Closed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants