pub async fn run_thread<T>(
event_processor: Box<dyn ProcessEvent<T> + Send + 'static>,
network_event_receiver: Option<Receiver<NetworkEvent>>,
event_receiver: Option<Receiver<T>>,
stat_timer_in_ms: u64,
thread_name: &str,
thread_sleep_time_in_ms: u64,
time_keeper_origin: &Timer,
) -> JoinHandle<()>
Expand description
Runs a permanent thread with an event loop
This thread will have,
- an event loop which processes incoming events
- a timer functionality which fires for each iteration of the event loop
If any work is done in the event loop, it will immediately begin the next iteration after this one. If no work is done in the current iteration, it will go to sleep thread_sleep_time_in_ms amount of time
§Arguments
event_processor
:network_event_receiver
:event_receiver
:stat_timer_in_ms
:thread_sleep_time_in_ms
:
returns: JoinHandle<()>
§Examples