Guest User

Untitled

a guest
Dec 10th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.25 KB | None | 0 0
  1. // some async fn
  2. void read(Callback callback)
  3.  
  4. void callAsyncFnFromFiber(alias asyncFn)()
  5. {
  6.     auto thisFiber = getThisFiber()
  7.     asyncFunc(=> { thisFiber.resume() })
  8.     thisFiber.yield()
  9. }
  10.  
  11. // from within fiber
  12. callAsyncFromFiber!read()
Add Comment
Please, Sign In to add comment