Skip to content

Commit

Permalink
Unsafe block on
Browse files Browse the repository at this point in the history
  • Loading branch information
kaimast committed Jan 18, 2025
1 parent 0f20215 commit 21d3e6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 5 additions & 3 deletions executor-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ pub fn test(_args: TokenStream, item: TokenStream) -> TokenStream {

let tokio_expr = quote! {
let runtime = kioto_uring_executor::Runtime::new();
runtime.block_on(async {
#body
})
unsafe {
runtime.unsafe_block_on(async {
#body
})
}
};

input.block = syn::parse2(quote! {
Expand Down
6 changes: 6 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ fn spawn() {

println!("{}", receiver.recv().unwrap());
}

#[kioto_uring_executor::test]
async fn executor_macro() {
sleep(Duration::from_millis(10)).await;
println!("Hello world");
}

0 comments on commit 21d3e6e

Please sign in to comment.