wpool_pool
A pool of workers.
A pool of workers. If you want to put it in your supervisor tree, remember it's a supervisor.
Functions
create_table() -> ok
Creates the ets table that will hold the information about active pools
start_link(Name::name() (see module wpool), Options::[option() (see module wpool)]) -> {ok, pid()} | {error, {already_started, pid()} | term()}
Starts a supervisor with several wpool_processes as its children
best_worker(Sup::name() (see module wpool)) -> atom()
Picks the worker with the smaller queue of messages.
random_worker(Sup::name() (see module wpool)) -> atom()
Picks a random worker
next_worker(Sup::name() (see module wpool)) -> atom()
Picks the next worker in a round robin fashion
available_worker(Sup::name() (see module wpool), Timeout::timeout()) -> atom()
Picks the first available worker. If all workers are busy, waits for Timeout ms until one is free
hash_worker(Sup::name() (see module wpool), HashKey::term()) -> atom()
Picks a worker base on a hash result.
phash2(Term, Range)
returns hash = integer, 0 <= hash < Range so
1
must be added
cast_to_available_worker(Sup::name() (see module wpool), Cast::term()) -> ok
Casts a message to the first available worker. Since we can wait forever for a wpool:cast to be delivered but we don't want the caller to be blocked, this function just forwards the cast when it gets the worker
stats(Sup::name() (see module wpool)) -> stats() (see module wpool)
Retrieves a snapshot of the pool stats
worker_names(Pool_Name::name() (see module wpool)) -> [atom()]
Returns the names of the workers in the pool
wpool_size(Name::atom()) -> non_neg_integer() | undefined
the number of workers in the pool