2013/7/6 MikeM <[email protected]>:
> Got an out of memory when experimenting with core.async channels in go
> blocks. The following is a simple example.
>
> (defn go-loop
> []
> (let [c0 (chan)]
>  (while true
>   (go
>     (>! c0 1))
>   (go
>     (println (<! c0))))))
>
> ;(.start (Thread. go-loop))
>
> Clojure 1.5.1, Java 1.7.0_25 32-bit running under Win7 x64.


hello,

Maybe you wanted to do this in a serialized way: go blocks return a
channel which will give back the resulting value of the go block.

So maybe you could surround (go (println (<! c0))) with a call to <!! :

(<!! (go (println (<! c0))))

This way you won't have this crazy while true making you run out of memory.


>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to