Guest User

Untitled

a guest
Sep 7th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import actors
  2.  
  3. proc secondActor(self: PActor[int,int]): void {.thread.} =
  4. while true:
  5. var task = self.recv()
  6. if task.shutDown:
  7. echo "Received Shutdown!!"
  8. return
  9. echo task.receiver == nil
  10.  
  11. proc firstActor(self: PActor[int,int]) : void {.thread.} =
  12. var actor = spawn[int, int](secondActor)
  13. actor.send(10, self)
  14. actor.sendShutDown()
  15. actor.join()
  16.  
  17. var actor = spawn[int, int](firstActor)
  18. actor.join()
Advertisement
Add Comment
Please, Sign In to add comment