use crate::actors::prelude::*;
use crate::examples::actors::basic::basic_actor;
use super::my_dispatcher::MyDispatcher;
use std::sync::{Mutex, Arc};
use std::thread;
use std::time::Duration;
struct OtherMsg {}
pub fn run() {
let my_dispatcher = MyDispatcher::new(1);
let mut system = LocalActorSystem::new();
system.add_dispatcher("my-dispatcher", tsafe!(my_dispatcher));
let custom_props = Props::new(tsafe!(basic_actor::BasicActor::new()))
.with_dispatcher("my-dispatcher");
let mut printer = system.actor_of(custom_props, None);
let msg = msg!(basic_actor::Print { text: String::from("Hello world!") });
printer.tell(msg, None);
let msg = msg!(OtherMsg {});
printer.tell(msg, None);
thread::sleep(Duration::from_secs(1));
system.stop(&mut printer);
thread::sleep(Duration::from_secs(1));
system.terminate();
thread::park();
}