You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a variation of the fiber interface that offers symmetric switching. The WasmFX instantiation of the interface should take advantage of the switch instruction.
I think something like the following will do:
/** The abstract type of a fiber object. **/typedefstructfiber*fiber_t;
/** The signature of a fiber entry point. **/typedefvoid* (*fiber_entry_point_t)(fiber_t, void*);
/** Allocates a new fiber with the default stack size. **/export("fiber_alloc")
fiber_tfiber_alloc(fiber_entry_point_tentry);
/** Reclaims the memory occupied by the fiber object. **/export("fiber_free")
voidfiber_free(fiber_tfiber);
/** Possible status codes for `fiber_resume`. **/typedefenum { FIBER_OK=0, FIBER_YIELD=1, FIBER_ERROR=2 } fiber_result_t;
/** Yields control to the given target. This function must be called from within a fiber context. **/export("fiber_switch")
fiber_result_tfiber_switch(fiber_ttarget, void*arg);
/** Initialises the fiber runtime context. **/export("fiber_main")
intfiber_main(int (*main)(int, char**));
The text was updated successfully, but these errors were encountered:
Implement a variation of the fiber interface that offers symmetric switching. The WasmFX instantiation of the interface should take advantage of the
switch
instruction.I think something like the following will do:
The text was updated successfully, but these errors were encountered: