pmap (util v1.3.5)

View Source

Parallel map and multicall.

Luke Gorries (http://lukego.livejournal.com) (pmap) $Date: 2008/07/02 03:29:58 $

Author: Serge Aleynikov saleyn@gmail.com (multicall)

Summary

Functions

Send messages to pids and wait for replies. Each Pid would get a message in the form: {{FromPid, Ref}, Msg} and would have to reply with: FromPid ! {{self(), Ref}, Reply}. The function aggregates all replies into Success and Error lists. The error list is in the form: {Pid, ErrorReason}.

Evaluate the MultiArgs list by calling F on each argument in the list concurrently. See: pmap/3.

Evaluate the MultiArgs list by calling F on each argument in the list concurrently. Same as pmap/2 but has a Timeout option.

Send a reply back to sender.

Functions

multicall/2

-spec multicall([{pid(), term()}], Timeout :: timeout()) ->
                   {[OkReply :: term()], [ErrorReply :: term()]}.

Send messages to pids and wait for replies. Each Pid would get a message in the form: {{FromPid, Ref}, Msg} and would have to reply with: FromPid ! {{self(), Ref}, Reply}. The function aggregates all replies into Success and Error lists. The error list is in the form: {Pid, ErrorReason}.

pmap(F, List)

-spec pmap(fun(() -> term()), [Args :: term()]) -> [Reply :: term()].

Evaluate the MultiArgs list by calling F on each argument in the list concurrently. See: pmap/3.

pmap(F, List, Timeout)

-spec pmap(fun((term()) -> term()), Args :: [term()], integer() | infinity) -> [Reply :: term()].

Evaluate the MultiArgs list by calling F on each argument in the list concurrently. Same as pmap/2 but has a Timeout option.

reply/2

-spec reply({pid(), reference()}, Reply :: term()) -> ok.

Send a reply back to sender.