From a29b16db27c0cd3c6cf1d1a4d8551174282bd296 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 1 Jul 2024 09:31:48 +0200 Subject: lanes.finally() handler decides whether to thow or freeze --- docs/index.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/index.html b/docs/index.html index 1cc007f..0cdf954 100644 --- a/docs/index.html +++ b/docs/index.html @@ -379,7 +379,7 @@ Sets the duration in seconds Lanes will wait for graceful termination of running lanes at application shutdown. Default is 0.25.
Lanes signals all lanes for cancellation with "soft", "hard", and "all" modes, in that order. Each attempt has shutdown_timeout seconds to succeed before the next one.
- Then there is a last chance at cleanup with lanes.finally(). If some lanes are still running after that point, shutdown will freeze the application forever. It is YOUR responsibility to cleanup properly after yourself. + Then there is a last chance at cleanup with lanes.finally(). If some lanes are still running after that point, shutdown will either freeze or throw. It is YOUR responsibility to cleanup properly after yourself. @@ -469,9 +469,10 @@

An error will be raised if you attempt to do this from inside a lane, or on bad arguments (non-function, or too many arguments).
Only the last registered finalizer is kept. It can be cleared by passing nil or nothing.
- The installed function is called after all free-running lanes got a chance to terminate (seeshutdown_timeout), but before lindas become unusable.
+ The finalizer is called unprotected from inside __gc metamethod of Lane's Universe. Therefore, if your finalizer raises an error, Lua rules regarding errors in finalizers apply normally.
+ The installed function is called after all free-running lanes got a chance to terminate (see shutdown_timeout), but before lindas become unusable.
The finalizer receives a single argument, a bool indicating whether some Lanes are still running or not at that point. It is possible to inspect them with tracking.
- If an error occurs inside this finalizer, it is silently swallowed, since it happens only during state shutdown, and you can't do anything about it. + If there are still running lanes when the finalizer returns: Lanes will throw a C++ std::logic_error if the finalizer returned "throw". Any other value will cause Lanes to freeze forever.


-- cgit v1.2.3-55-g6feb