winctx 0.0.20

A minimal window context for Rust on Windows.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use anyhow::Result;
use tokio::signal::ctrl_c;
use winctx::NamedMutex;

const NAME: &str = "se.tedro.Example";

#[tokio::main]
async fn main() -> Result<()> {
    let Some(_m) = NamedMutex::create_acquired(NAME)? else {
        println!("Mutex '{NAME}' already acquired");
        return Ok(());
    };

    ctrl_c().await?;
    Ok(())
}