mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
27 lines
720 B
Rust
27 lines
720 B
Rust
use std::{io, thread};
|
|
use tokio::runtime;
|
|
|
|
pub type FlowyRuntime = tokio::runtime::Runtime;
|
|
|
|
pub fn tokio_default_runtime() -> io::Result<FlowyRuntime> {
|
|
runtime::Builder::new_multi_thread()
|
|
.thread_name("dispatch-rt")
|
|
.enable_io()
|
|
.enable_time()
|
|
.on_thread_start(move || {
|
|
tracing::trace!(
|
|
"{:?} thread started: thread_id= {}",
|
|
thread::current(),
|
|
thread_id::get()
|
|
);
|
|
})
|
|
.on_thread_stop(move || {
|
|
tracing::trace!(
|
|
"{:?} thread stopping: thread_id= {}",
|
|
thread::current(),
|
|
thread_id::get(),
|
|
);
|
|
})
|
|
.build()
|
|
}
|