added tactors2 test
This commit is contained in:
parent
32aa46a881
commit
505f179515
1 changed files with 25 additions and 0 deletions
25
tests/threads/tactors2.nim
Normal file
25
tests/threads/tactors2.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
discard """
|
||||||
|
output: "1"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import actors
|
||||||
|
|
||||||
|
type
|
||||||
|
some_type {.pure, final.} = object
|
||||||
|
bla: int
|
||||||
|
|
||||||
|
proc thread_proc(input: some_type): some_type {.thread.} =
|
||||||
|
result.bla = 1
|
||||||
|
|
||||||
|
proc main() =
|
||||||
|
var actorPool: TActorPool[some_type, some_type]
|
||||||
|
createActorPool(actorPool, 1)
|
||||||
|
|
||||||
|
var some_data: some_type
|
||||||
|
|
||||||
|
var inchannel = spawn(actorPool, some_data, thread_proc)
|
||||||
|
var recv_data = ^inchannel
|
||||||
|
close(inchannel[])
|
||||||
|
echo recv_data.bla
|
||||||
|
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue