/// 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.
-///BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
#[must_use]
#[repr(C)]
pub struct BackgroundProcessor {
}
}
}
-/// Start a background thread that takes care of responsibilities enumerated in the [top-level
-/// documentation].
+/// Start a background thread that takes care of responsibilities enumerated in the top-level
+/// documentation.
///
-/// The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
-/// `persist_manager` returns an error. In case of an error, the error is retrieved by calling
-/// either [`join`] or [`stop`].
-///
-/// Typically, users should either implement [`ChannelManagerPersister`] to never return an
-/// error or call [`join`] and handle any error that may arise. For the latter case, the
-/// `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
+/// If `persist_manager` returns an error, then this thread will return said error (and
+/// `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
+/// wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
+/// returned, or implement `persist_manager` such that an error is never returned to the
+/// `BackgroundProcessor`
///
/// `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
/// uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
/// [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
/// provided implementation.
///
-/// [top-level documentation]: Self
-/// [`join`]: Self::join
-/// [`stop`]: Self::stop
+/// [`thread_handle`]: BackgroundProcessor::thread_handle
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
/// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
/// [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
BackgroundProcessor { inner: Box::into_raw(Box::new(ret)), is_owned: true }
}
-/// Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
-/// [`ChannelManager`].
-///
-/// # Panics
-///
-/// This function panics if the background thread has panicked such as while persisting or
-/// handling events.
-///
-/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
-#[must_use]
-#[no_mangle]
-pub extern "C" fn BackgroundProcessor_join(mut this_arg: BackgroundProcessor) -> crate::c_types::derived::CResult_NoneErrorZ {
- let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).join();
- let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_rust(e) }).into() };
- local_ret
-}
-
-/// Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
-/// [`ChannelManager`].
-///
-/// # Panics
-///
-/// This function panics if the background thread has panicked such as while persisting or
-/// handling events.
-///
-/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
+/// Stop `BackgroundProcessor`'s thread.
#[must_use]
#[no_mangle]
pub extern "C" fn BackgroundProcessor_stop(mut this_arg: BackgroundProcessor) -> crate::c_types::derived::CResult_NoneErrorZ {