[−][src]Macro ffi_helpers::export_task
Convenience macro to define the FFI bindings for working with a Task
.
This is implemented as an incremental TT muncher which lets you define the functions you'll need. These are:
spawn
: The function for spawning a task on a background thread, returning aTaskHandle
poll
: A function for receiving the result if it's availablewait
: Block the current thread until we get either a result or an errorcancel
: Cancel the background taskcancelled
: Has the task already been cancelled?result_destroy
: A destructor for the task's resulthandle_destroy
: A destructor for theTaskHandle
, for cleaning up the task once you're done with it
You'll always need to provide the concrete Task
type in the macro's
first "argument".