tactors2.nim 442 B

1234567891011121314151617181920212223242526
  1. discard """
  2. output: "1"
  3. """
  4. import actors
  5. type
  6. some_type {.pure, final.} = object
  7. bla: int
  8. proc thread_proc(input: some_type): some_type {.thread.} =
  9. result.bla = 1
  10. proc main() =
  11. var actorPool: TActorPool[some_type, some_type]
  12. createActorPool(actorPool, 1)
  13. var some_data: some_type
  14. var inchannel = spawn(actorPool, some_data, thread_proc)
  15. var recv_data = ^inchannel
  16. close(inchannel[])
  17. echo recv_data.bla
  18. main()