Module ppool_serv

Internal: the pool server, a gen_server registered under the pool's name.

Behaviours: gen_server.

Description

Internal: the pool server, a gen_server registered under the pool's name. It tracks how many workers are running, monitors them, and holds the queue of waiting requests. Applications should use the ppool module instead.

Function Index

async_queue/2See ppool:async_queue/2.
code_change/3
handle_call/3
handle_cast/2
handle_info/2
init/1
run/2See ppool:run/2.
start/4Starts an unlinked pool server (not used by the library itself).
start_link/4Starts a pool server linked to the caller, registered as Name.
status/1See ppool:status/1.
stop/1Stops the pool server normally.
sync_queue/2See ppool:sync_queue/2.
terminate/2

Function Details

async_queue/2

async_queue(Name::atom(), Args::list()) -> ok

See ppool:async_queue/2. A cast to a name nobody has registered is silently dropped, so a mistyped pool name would look like success. Rather than turn the cast into a call (which would make the caller wait for the pool), check that the name resolves first, and fail the way the calls in this module do when there is no pool: exit with noproc. The check and the cast are not atomic; a pool that dies in between still loses the request, as it would anyway.

code_change/3

code_change(OldVsn, State, Extra) -> any()

handle_call/3

handle_call(Msg, From, S) -> any()

handle_cast/2

handle_cast(Msg, S) -> any()

handle_info/2

handle_info(Msg, S) -> any()

init/1

init(X1) -> any()

run/2

run(Name::atom(), Args::list()) -> {ok, pid() | undefined} | noalloc | {error, term()}

See ppool:run/2.

start/4

start(Name::atom(), Limit::integer(), Sup::pid(), MFA::{module(), atom(), list()}) -> {ok, pid()} | ignore | {error, term()}

Starts an unlinked pool server (not used by the library itself).

start_link/4

start_link(Name::atom(), Limit::integer(), Sup::pid(), MFA::{module(), atom(), list()}) -> {ok, pid()} | ignore | {error, term()}

Starts a pool server linked to the caller, registered as Name. Sup is the pool's supervisor, in which the worker supervisor is started.

status/1

status(Name::atom()) -> tuple()

See ppool:status/1.

stop/1

stop(Name::atom()) -> ok

Stops the pool server normally. Its supervisor is permanent for it, so the pool is restarted empty.

sync_queue/2

sync_queue(Name::atom(), Args::list()) -> {ok, pid() | undefined} | {error, term()}

See ppool:sync_queue/2.

terminate/2

terminate(Reason, State) -> any()


Generated by EDoc