pub fn start_slot_worker_thread<B, C, W, SO, SC, OnExit>(
	slot_duration: SlotDuration,
	client: Arc<C>,
	worker: Arc<W>,
	sync_oracle: SO,
	on_exit: OnExit,
	inherent_data_providers: InherentDataProviders,
) -> Result<(), consensus_common::Error> where
	B: Block + 'static,
	C: ChainHead<B> + Send + Sync + 'static,
	W: SlotWorker<B> + Send + Sync + 'static,
	SO: SyncOracle + Send + Clone + 'static,
	SC: SlotCompatible + 'static,
	OnExit: Future<Item=(), Error=()> + Send + 'static
{
	use tokio::runtime::current_thread::Runtime;

	let (result_sender, result_recv) = mpsc::channel();

	thread::spawn(move || {
		let mut runtime = match Runtime::new() {
			Ok(r) => r,
			Err(e) => {
				warn!("Unable to start authorship: {:?}", e);
				return;
			}
		};

		let slot_worker_future = match start_slot_worker::<_, _, _, _, SC, _>(
			slot_duration,
			client,
			worker,
			sync_oracle,
			on_exit,
			inherent_data_providers,
		) {
			Ok(slot_worker_future) => {
				result_sender
					.send(Ok(()))
					.expect("Receive is not dropped before receiving a result; qed");
				slot_worker_future
			},
			Err(e) => {
				result_sender
					.send(Err(e))
					.expect("Receive is not dropped before receiving a result; qed");
				return;
			}
		};

		let _ = runtime.block_on(slot_worker_future);
	});

	result_recv.recv().expect("Aura start thread result sender dropped")
}
/// Start a new slot worker in a separate thread.
Start a new slot worker in a separate thread.
Start a new slot worker in a separate thread .
pub fn start_slot_worker_thread<B, C, W, SO, SC, OnExit>(
	slot_duration: SlotDuration,
	client: Arc<C>,
	worker: Arc<W>,
	sync_oracle: SO,
	on_exit: OnExit,
	inherent_data_providers: InherentDataProviders,
) -> Result<(), consensus_common::Error> where
	B: Block + 'static,
	C: ChainHead<B> + Send + Sync + 'static,
	W: SlotWorker<B> + Send + Sync + 'static,
	SO: SyncOracle + Send + Clone + 'static,
	SC: SlotCompatible + 'static,
	OnExit: Future<Item=(), Error=()> + Send + 'static
{
	use tokio::runtime::current_thread::Runtime;
	let (result_sender, result_recv) = mpsc::channel();
	thread::spawn(move || {
		let mut runtime = match Runtime::new() {
			Ok(r) => r,
			Err(e) => {
				warn!("Unable to start authorship: {:?}", e);
				return;
			}
		};
		let slot_worker_future = match start_slot_worker::<_, _, _, _, SC, _>(
			slot_duration,
			client,
			worker,
			sync_oracle,
			on_exit,
			inherent_data_providers,
		) {
			Ok(slot_worker_future) => {
				result_sender
					.send(Ok(()))
					.expect("Receive is not dropped before receiving a result; qed");
				slot_worker_future
			},
			Err(e) => {
				result_sender
					.send(Err(e))
					.expect("Receive is not dropped before receiving a result; qed");
				return;
			}
		};
		let _ = runtime.block_on(slot_worker_future);
	});
	result_recv.recv().expect("Aura start thread result sender dropped")
}
pub fn start_slot_worker_thread < B , C , W , SO , SC , OnExit > ( slot_duration : SlotDuration , client : Arc < C > , worker : Arc < W > , sync_oracle : SO , on_exit : OnExit , inherent_data_providers : InherentDataProviders , ) -> Result < ( ) , consensus_common :: Error > where B : Block + ' static , C : ChainHead < B > + Send + Sync + ' static , W : SlotWorker < B > + Send + Sync + ' static , SO : SyncOracle + Send + Clone + ' static , SC : SlotCompatible + ' static , OnExit : Future < Item = ( ) , Error = ( ) > + Send + ' static { use tokio :: runtime :: current_thread :: Runtime ; let ( result_sender , result_recv ) = mpsc :: channel ( ) ; thread :: spawn ( move | | { let mut runtime = match Runtime :: new ( ) { Ok ( r ) => r , Err ( e ) => { warn ! ( " " e ) ; return ; } } ; let slot_worker_future = match start_slot_worker :: < _ , _ , _ , _ , SC , _ > ( slot_duration , client , worker , sync_oracle , on_exit , inherent_data_providers , ) { Ok ( slot_worker_future ) => { result_sender . send ( Ok ( ( ) ) ) . expect ( " " ) ; slot_worker_future } , Err ( e ) => { result_sender . send ( Err ( e ) ) . expect ( " " ) ; return ; } } ; let _ = runtime . block_on ( slot_worker_future ) ; } ) ; result_recv . recv ( ) . expect ( " " ) }
Start a new slot worker in a separate thread.
Start a new slot worker in a separate thread .
slot_duration
SlotDuration
client
Arc<C>
worker
Arc<W>
sync_oracle
SO
on_exit
OnExit
inherent_data_providers
InherentDataProviders
slot_duration
SlotDuration
client
Arc<C>
worker
Arc<W>
sync_oracle
SO
on_exit
OnExit
inherent_data_providers
InherentDataProviders