gen_timer v0.0.3 GenTimer
A GenServer for asynchronously running a function after some duration.
Usage
Register a function and a duration. The function will be called after the duration. If using start_repeated/4
or
start_link_repeated/4
it will continue for the specified amount of times.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Imported by GenServer.__using__/1
Synchronously calls the GenServer
at pid
to receive the last value returned by the registered function. All previous
returned values will not be kept.
Starts a GenServer
process without links (outside of a supervision tree). The function
is registered. After the
milli
duration the function will be called using specified args
.
Starts a GenServer
process linked to the current process. The function
is registered. After the
milli
duration the function will be called using specified args
.
The same as start_link/3
but allows to specify an amount of times
to repeat, defaulting to :infinite
.
The same as start/3
but allows to specify an amount of times
to repeat, defaulting to :infinite
.
Link to this section Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
init(state)
Imported by GenServer.__using__/1
Synchronously calls the GenServer
at pid
to receive the last value returned by the registered function. All previous
returned values will not be kept.
start(function, args, milli)
start((... -> {any(), new_state :: any()}), list(), non_neg_integer()) :: GenServer.on_start()
Starts a GenServer
process without links (outside of a supervision tree). The function
is registered. After the
milli
duration the function will be called using specified args
.
start_link(function, args, milli)
start_link((... -> {any(), new_state :: any()}), list(), non_neg_integer()) :: GenServer.on_start()
Starts a GenServer
process linked to the current process. The function
is registered. After the
milli
duration the function will be called using specified args
.
start_link_repeated(function, args, milli, times \\ :infinite)
start_link_repeated( (... -> {any(), new_state :: any()}), list(), non_neg_integer(), non_neg_integer() | :infinite ) :: GenServer.on_start()
The same as start_link/3
but allows to specify an amount of times
to repeat, defaulting to :infinite
.
start_repeated(function, args, milli, times \\ :infinite)
start_repeated( (... -> {any(), new_state :: any()}), list(), non_neg_integer(), non_neg_integer() | :infinite ) :: GenServer.on_start()
The same as start/3
but allows to specify an amount of times
to repeat, defaulting to :infinite
.