Hi Paul,

What you're looking for is Factor's concurrency library. For example,
using the concurrency.combinators vocab, you can do

{ "http://www.apple.com"; "http://www.ibm.com"; } [ http-get nip ] parallel-map

You might also look at the following vocabs: threads,
concurrency.futures, and concurrency.messaging, and in general, all of
the sub-vocabularies of the concurrency vocabulary. Everything is
fully documented.

Note that Factor's threads are co-operative, however they can execute
I/O concurrently because under the hood everything uses your operating
system's non-blocking I/O API (kqueue on *BSD, epoll on Linux, IOCP on
Windows). Indeed, concatenative.org and factorcode.org can handle many
concurrent requests this way.

Have fun,

Slava

On Thu, Jan 15, 2009 at 5:25 AM, Paul Moore <[email protected]> wrote:
> I'm trying to write a small program in factor that requests multiple web
> pages from a server. However, the server can take a substantial time
> returning a page, so I'd like the requests to run concurrently.
>
> A few tests with future and http-get seem to indicate that http-get
> blocks, and as a result the requests are *not* handled concurrently.
>
> Is there a way of running a large number (up to 100 or so) http GET
> requests concurrently?
>
> Apologies if this is the wrong place for questions like this. If there's
> somewhere else I should go, please let me know where!
>
> Thanks,
> Paul.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to