2 unstable releases
new 0.1.0-beta | Nov 24, 2024 |
---|---|
0.0.0 | Nov 23, 2024 |
#18 in #join
64 downloads per month
14KB
178 lines
Here is Asyncra
Full unblocking async runtime
Example
use tokio::join;
use asyncra::SharedValue;
#[asyncra::main]
async fn main() -> asyncra::Result<()> {
let num = SharedValue::new(12);
let num_c = num.clone();
let first = tokio::task::spawn( async move {
for _ in 0..10 {
let num_3 = num_c.read::<i32>().await;
println!("Num now is: {num_3}");
}
});
let second = tokio::task::spawn(async move {
for _ in 0..10 {
let num_ = num.read::<i32>().await;
num.write(num_ + 1);
}
});
join!(first, second);
Ok(())
}
Installation
cargo add asyncra
TODO
- Add task and thread spawner
- Add join macros for launch parallel threads at the same time
License
Dependencies
~10–22MB
~308K SLoC