removed complexity (Send is an illusion)
This commit is contained in:
parent
f44ab92299
commit
918f11598a
1 changed files with 2 additions and 4 deletions
|
@ -11,12 +11,10 @@ async fn main() -> Result<()> {
|
||||||
let (tx,rx) = oneshot::channel();
|
let (tx,rx) = oneshot::channel();
|
||||||
|
|
||||||
let func: Symbol<unsafe extern fn(u64,u64, Receiver<u64>) -> Pin<Box<dyn Future<Output = u64> + Send>>> = unsafe {lib.get(b"add_wrapper")?};
|
let func: Symbol<unsafe extern fn(u64,u64, Receiver<u64>) -> Pin<Box<dyn Future<Output = u64> + Send>>> = unsafe {lib.get(b"add_wrapper")?};
|
||||||
let func = unsafe{func.into_raw()};
|
|
||||||
let fut = unsafe{func(12,54, rx)};
|
let fut = unsafe{func(12,54, rx)};
|
||||||
|
|
||||||
let out = tokio::spawn(async move {
|
let out = tokio::spawn(fut);
|
||||||
fut.await
|
|
||||||
});
|
|
||||||
|
|
||||||
tx.send(8).unwrap();
|
tx.send(8).unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue