Re: clojure future method

2016-02-15 Thread Mike Sassak
Is the future returning a lazy seq? You might need to walk the seq with
doseq / dorun etc.

On Mon, Feb 15, 2016, 6:02 AM Gary Verhaegen 
wrote:

> `future` starts a function in a separate thread, which comes out of a
> thread pool. It may not be that easy to check if a future has run at
> all if you don't hold onto the future object and wait for it.
>
> How did you check if they run? It's possible, for example, that they
> are sending their print's to a different output than the rest of your
> code, depending on your development setup; it's also possible (though
> less likely) that in your experimentation you have somehow depleted
> your thread pool and so they are queued somewhere.
>
> Ideally, to maximize our chances of helping you, you would provide a
> minimal, stand-alone snippet of code that demonstrates your problem.
>
> On 15 February 2016 at 12:31, Punit Naik  wrote:
> > I have a function which calls a number of functions in sequence. Few of
> them
> > are normal functions and some of them use clojure's 'future' method.
> When I
> > run this function, All the normal fuctions run but the functions which
> use
> > 'future' don't run at all. But if I run the functions which use 'future'
> > individually, they run perfectly fine.
> >
> > Can anyone point me to a solution?
> >
> > Please help!
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > 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 clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Concurrency Threads

2016-02-12 Thread Mike Sassak
Hi Fernando,

You could try agents, but I'm not sure they're a good fit for periodic
execution. I suggest looking at the scheduled Executors in
java.util.concurrent, and then using them in your Clojure code. Mixes
pretty much seamlessly with Clojure's refs and functions (indeed much of
Clojure's concurrency on the JVM is built on top of j.u.concurrent).

Mike

On Fri, Feb 12, 2016, 4:59 PM Fernando Abrao  wrote:

> Hello All,
>
> I 'm doing a program that have to:
> - Read a file with list of hosts ip
> - Start pinging from n threads pool or whatever
> - Cycle the pinging again after thread sleep
> What is the best way doing it? Producer and consumer to use queue? One
> thread by ip?
> Any advice about it?
>
> Regards,
>
> Fernando
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.