Module pmap

Version: $Rev$ $Date: 2008/07/02 03:29:58 $

Authors: Serge Aleynikov (saleyn@gmail.com).

Description

Parallel map and multicall.

Function Index

multicall/2Send messages to pids and wait for replies.
pmap/2Evaluate the MultiArgs list by calling F on each argument in the list concurrently.
pmap/3Evaluate the MultiArgs list by calling F on each argument in the list concurrently.
reply/2Send a reply back to sender.
test/0
test1/0
test2/0
test3/0

Function Details

multicall/2

multicall(PidMsgs :: [{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/2

pmap(F :: fun(() -> term()), List :: [Args :: term()]) ->
        [Reply :: term()]

Evaluate the MultiArgs list by calling F on each argument in the list concurrently.

See also: pmap/3.

pmap/3

pmap(F :: fun((term()) -> term()),
     Args :: [term()],
     Timeout :: 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

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

Send a reply back to sender.

test/0

test() -> any()

test1/0

test1() -> any()

test2/0

test2() -> any()

test3/0

test3() -> any()