Crates.io | acter_queue |
lib.rs | acter_queue |
version | 0.1.0 |
source | src |
created_at | 2020-11-17 04:28:21.587628 |
updated_at | 2020-11-17 04:28:21.587628 |
description | fast speed thread safe async execute queue. |
homepage | |
repository | https://github.com/luyikk/actor_queue |
max_upload_size | |
id | 313166 |
size | 7,484 |
#Examples
use acter_queue::AQueue;
static mut VALUE:i32=0;
#[tokio::main]
async fn main()->Result<(),Box<dyn Error+Sync+Send>> {
let queue = AQueue::new();
let mut v=0i32;
for i in 0..2000000 {
v= queue.run(async move |x| unsafe {
// thread safe execute
VALUE += x;
Ok(VALUE)
}, i).await?;
}
assert_eq!(v,-1455759936);
}