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.

Data Types

queued()

queued() = {gen_server:from(), list()} | list()

reply()

reply() = {ok, pid()} | {error, term()} | noalloc | state()

state()

state() = #state{limit = integer(), sup = pid() | undefined, refs = gb_sets:set(reference()), queue = queue:queue(queued()), name = ppool:name()}

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, Args) -> Result

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) -> Result

handle_call/3

handle_call(Request, From, State) -> Result

handle_cast/2

handle_cast(Request, State) -> Result

handle_info/2

handle_info(Info, State) -> Result

init/1

init(Args) -> Result

run/2

run(Name, Args) -> Result

See ppool:run/2.

start/4

start(Name, Limit, Sup, MFA) -> Result

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

start_link/4

start_link(Name, Limit, Sup, MFA) -> Result

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) -> Result

See ppool:status/1.

stop/1

stop(Name) -> Result

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

sync_queue/2

sync_queue(Name, Args) -> Result

See ppool:sync_queue/2.

terminate/2

terminate(Reason, State) -> Result


Generated by EDoc