package lwt
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=6bb978c590433a218a53722b985a01d4
sha512=529c8c920716cf204efd60a2bad3f817eed6eed120a8e8a8dae763ab7f4c45799a74004d0d0a2b8ec08f37c81b77f1a4813426a25f256b254dfa846c86debe44
doc/lwt.unix/Lwt_timeout/index.html
Module Lwt_timeoutSource
Cancelable timeouts.
Lwt_timeout.create n f creates a new timeout object with duration n seconds. f is the action, a function to be called once the timeout expires. f should not raise exceptions.
The timeout is not started until Lwt_timeout.start is called on it.
Starts the given timeout.
Starting a timeout that has already been started has the same effect as stopping it, and then restarting it with its original duration. So, suppose you have timeout with a duration of three seconds, which was started two seconds ago. The next call to its action is scheduled for one second in the future. Calling Lwt_timeout.start timeout at this point cancels this upcoming action call, and schedules a call three seconds from now.
Changes the duration of the given timeout.
If the timeout has already been started, it is stopped, and restarted with its new duration. This is similar to how Lwt_timeout.start works on a timeout that has already been started.
Lwt_timeout.set_exn_handler f sets the handler to be used for exceptions raised by timeout actions. Recall that actions are not allowed to raise exceptions. If they do raise an exception exn despite this, f exn is called.
The default behavior of f exn, set by Lwt_timeout on program startup, is to pass exn to !Lwt.async_exception_hook. The default behavior of that is to terminate the process.