coroutines.zy 556 B

12345678910111213141516171819
  1. // warning: the race detector fires on (go (send ch %foo)) currently.
  2. // So we must comment this out while checking for other races.
  3. //
  4. // In fact, we should deprecate using the co/goroutines via (go)
  5. // because it is not goroutine safe. Comment this out in preparation for that.
  6. /*
  7. (def ch (makeChan))
  8. // test that channels and symbol translation are working
  9. (go (send ch %foo))
  10. (assert (== %foo (<! ch)))
  11. // test that coroutines share the same global scope
  12. (def global "foo")
  13. (go (def global "bar") (send ch %()))
  14. (<! ch)
  15. (assert (== global "bar"))
  16. */