0.1.0 |
|
---|
#114 in #speed
7KB
120 lines
fast speed thread safe async execute queue
#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);
}
Dependencies
~4MB
~67K SLoC