I only support trivial types, checked at compile-time via supportsCopyMem(T).

What I do is here: 
[https://github.com/mratsim/weave/blob/v0.1.0/weave/parallel_tasks.nim#L125-L150](https://github.com/mratsim/weave/blob/v0.1.0/weave/parallel_tasks.nim#L125-L150)
 From the function call `spawn foo(a, b, c)`, I check the return type (void or 
if I need a future).

I package the following in a task:

  * `foo` address
  * The future/flowvar address which is just a channel
  * a, b, c as raw bytes.



The task is allocated on a shared memory heap via a memory pool (or via 
malloc). It is load-balanced between threads if needed and when comes execution:

  * I just dereference the address of the raw (a, b, c) to the packaged 
function `foo`.
  * If there was any result, I send it through the future/flowvar channel.


Reply via email to