2021-07-02 20:45:51 +08:00
|
|
|
use std::{io, thread};
|
|
|
|
use thread_id;
|
|
|
|
use tokio::runtime;
|
|
|
|
|
2021-06-24 16:32:36 +08:00
|
|
|
pub mod ready;
|
2021-07-02 20:45:51 +08:00
|
|
|
|
2021-09-17 19:03:46 +08:00
|
|
|
pub fn tokio_default_runtime() -> io::Result<tokio::runtime::Runtime> {
|
2021-07-02 20:45:51 +08:00
|
|
|
runtime::Builder::new_multi_thread()
|
2021-07-03 14:14:10 +08:00
|
|
|
.thread_name("flowy-rt")
|
2021-07-02 20:45:51 +08:00
|
|
|
.enable_io()
|
|
|
|
.enable_time()
|
|
|
|
.on_thread_start(move || {
|
2021-09-13 15:51:13 +08:00
|
|
|
log::trace!("{:?} thread started: thread_id= {}", thread::current(), thread_id::get());
|
2021-07-02 20:45:51 +08:00
|
|
|
})
|
|
|
|
.on_thread_stop(move || {
|
2021-09-13 15:51:13 +08:00
|
|
|
log::trace!("{:?} thread stopping: thread_id= {}", thread::current(), thread_id::get(),);
|
2021-07-02 20:45:51 +08:00
|
|
|
})
|
|
|
|
.build()
|
|
|
|
}
|