mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-01-18 21:34:48 +01:00
Make BackgroundProcessor #[must_use]
to avoid dropping immediately
It is easy for users to have a bug where they drop a `BackgroundProcessor` immediately, causing it to start and then immediately stop. Instead, add a `#[must_use]` tag to provide a compiler warning for such instances.
This commit is contained in:
parent
cab2ca8eeb
commit
5307b5e8ce
@ -39,6 +39,7 @@ use std::ops::Deref;
|
||||
/// then there is a risk of channels force-closing on startup when the manager realizes it's
|
||||
/// outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
|
||||
/// for unilateral chain closure fees are at risk.
|
||||
#[must_use = "BackgroundProcessor will immediately stop on drop. It should be stored until shutdown."]
|
||||
pub struct BackgroundProcessor {
|
||||
stop_thread: Arc<AtomicBool>,
|
||||
thread_handle: Option<JoinHandle<Result<(), std::io::Error>>>,
|
||||
|
Loading…
Reference in New Issue
Block a user