File: reentrant.rs

package info (click to toggle)
rust-async-backtrace 0.2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 252 kB
  • sloc: makefile: 2
file content (31 lines) | stat: -rw-r--r-- 780 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/// A test that a blocking threaddump does not deadlock a program when requested
/// from within a `framed` task.
mod util;
use async_backtrace::framed;

#[test]
fn reentrant() {
    util::model(|| util::run(outer()));
}

#[framed]
async fn outer() {
    let dump = async_backtrace::taskdump_tree(true);
    pretty_assertions::assert_str_eq!(
        util::strip(dump),
        "\
╼ reentrant::outer::{{closure}} at tests/reentrant.rs:LINE:COL"
    );
    inner().await;
}

#[framed]
async fn inner() {
    let dump = async_backtrace::taskdump_tree(true);
    pretty_assertions::assert_str_eq!(
        util::strip(dump),
        "\
╼ reentrant::outer::{{closure}} at tests/reentrant.rs:LINE:COL
  └╼ reentrant::inner::{{closure}} at tests/reentrant.rs:LINE:COL"
    );
}