summaryrefslogtreecommitdiffstats
path: root/src/runtime/threadable.rs
blob: 83b78a476416d1a571ed2fbcf21db87648d92254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::runtime::Installer;

/// An interface for a entity that has threads managed by the `Runtime`.
pub(crate) trait Threadable: Send {
	/// Method that installs the threads that the `Threadable` is responsible for.
	fn install(&self, installer: &Installer);

	/// Called when threads are requested to pause.
	///
	/// # Errors
	/// Returns an error is that thread cannot be paused for any reason.
	fn pause(&self) {}

	/// Called when threads are requested to resume.
	///
	/// # Errors
	/// Returns an error is that thread cannot be resumed for any reason.
	fn resume(&self) {}

	/// Called when threads are requested to finish.
	///
	/// # Errors
	/// Returns an error is that thread cannot be ended for any reason.
	fn end(&self) {}
}