mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-27 02:02:53 +01:00
This adds the ContextGuard struct from the taproot-assets repository that has been in use there for a while. The context guard allows for easy creation of contexts that depend on a central wait group and quit channel. A context can either be created with a timeout and quit, meaning it will cancel either on reaching the timeout or when the central quit channel is closed. Or a context can be created to block and use a timeout, meaning it will _not_ cancel on quit but rather block the shutdown until it is completed (or times out). The third way is to create a context that just cancels on quit with no timeout.