MCPcopy Create free account
hub / github.com/actix/examples / main

Function main

run-in-thread/src/main.rs:35–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33}
34
35fn main() {
36 env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
37
38 let (tx, rx) = mpsc::channel();
39
40 log::info!("spawning thread for server");
41 thread::spawn(move || {
42 let server_future = run_app(tx);
43 rt::System::new().block_on(server_future)
44 });
45
46 let server_handle = rx.recv().unwrap();
47
48 log::info!("waiting 10 seconds");
49 thread::sleep(time::Duration::from_secs(10));
50
51 // Send a stop signal to the server, waiting for it to exit gracefully
52 log::info!("stopping server");
53 rt::System::new().block_on(server_handle.stop(true));
54}

Callers

nothing calls this directly

Calls 3

run_appFunction · 0.85
sleepFunction · 0.85
stopMethod · 0.80

Tested by

no test coverage detected