SYNOPSIS

#include <sys/driver_hooks.h>
set_driver_hook( H_RESET, value)

DESCRIPTION

Arguments:
  • value (closure) – void|int <closure> ( void )
  • value (string) – void <name>(1)

Optional hook to reset an object. Hook setting can be unbound lambda closures, or the name of the function (static or public) to call in the object.

If the hook is a closure, it is bound to the object to be reset and called with no argument.

If the result of this call is a positive number, it is used as the interval to wait before the next reset(A). If the result is 0, the default interval computed from TIME_TO_RESET is used. If the result is a negative number, the object will not be reset again, unless directed otherwise by set_next_reset(E).

If the hook is defined as the name of an lfun in the object, it is called in the object with 1 as argument, and any result is ignored. In this call the previous_object(E) is the object initiating the reset. If the function does not exist, the object won’t be reset again.

Note

an object is only reset by call to this hook if it has been used since the last reset.

HISTORY

  • changed (3.2.10) – allowed static functions to be given by name.

SEE ALSO

hook