async.monkey2 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Namespace std.async
  2. #import "native/async.cpp"
  3. #import "native/async_cb.cpp"
  4. #import "native/async.h"
  5. #import "native/async_cb.h"
  6. #If __TARGET__="android"
  7. #Import "native/Monkey2Async.java"
  8. #Endif
  9. #If __TARGET__="raspbian" Or __TARGET__="linux"
  10. #Import "<libpthread.a>" 'WTH? Didn't used to need this!
  11. #Endif
  12. Extern
  13. #rem monkeydoc @hidden
  14. Internal struct used to deliver events from remote threads.
  15. Probably best to just forget you even saw this...
  16. #end
  17. Struct AsyncEvent="bbAsync::Event"
  18. Method Post()="post"
  19. Method Dispatch() Virtual="dispatch"
  20. End
  21. 'Should be invoked on mx2 thread.
  22. #rem monkeydoc @hidden
  23. #end
  24. Function CreateAsyncCallback:Int( func:Void(),oneshot:bool )="bbAsync::createAsyncCallback"
  25. 'Should be invoked on mx2 thread. No effect if callback has been posted.
  26. #rem monkeydoc @hidden
  27. #end
  28. Function DestroyAsyncCallback:Int( callback:Int )="bbAsync::destroyAsyncCallback"
  29. 'Can be invoked on any thread.
  30. #rem monkeydoc @hidden
  31. #end
  32. Function InvokeAsyncCallback( callback:Int )="bbAsync::invokeAsyncCallback"
  33. Public