Type Definition bern_kernel::task::RunnableResult[][src]

type RunnableResult = ();
Expand description

Issue with closures and static tasks

Every closure has its own anonymous type. A closure can only be stored in a generic struct. The task object stored in the task “list” (array) must all have the same size -> not generic. Thus, the closure can only be referenced as trait object. But need to force the closure to be static, so our reference can be as well. A static closure is not possible, as every static needs a specified type. To overcome the issue of storing a closure into a static task we need to copy it into a static stack. Access to the closure is provided via a closure trait object, which now references a static object which cannot go out of scope.