message: feat: give an unique id to each global runtime thread
diff: @@ -4,7 +4,10 @@ use ckb_logger::debug;
  use ckb_spawn::Spawn;
  use ckb_stop_handler::{SignalSender, StopHandler};
  use core::future::Future;
  -use std::thread;
  +use std::{
  + sync::atomic::{AtomicU32, Ordering},
  + thread,
  +};
  use tokio::runtime::Builder;
  use tokio::runtime::Handle as TokioHandle;
  use tokio::sync::oneshot;
  @@ -54,7 +57,32 @@ impl Handle {
  pub fn new_global_runtime() -> (Handle, StopHandler<()>) {
  let runtime = Builder::new_multi_thread()
  .enable_all()
  - .thread_name("ckb-global-runtime")
  + .thread_name("GlobalRt")
  + .thread_name_fn(|| {
  + static ATOMIC_ID: AtomicU32 = AtomicU32::new(0);
  + let id = ATOMIC_ID
  + .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |n| {
  + // A long thread name will cut to 15 characters in debug tools.
  + // Such as "top", "htop", "gdb" and so on.
  + // It's a kernel limit.
  + //
  + // So if we want to see the whole name in debug tools,
  + // this number should have 6 digits at most,
  + // since the prefix uses 9 characters in below code.
  + //
  + // There still has a issue:
  + // When id wraps around, we couldn't know whether the old id
  + // is released or not.
  + // But we can ignore this, because it's almost impossible.
  + if n >= 999_999 {
  + Some(0)
  + } else {
  + Some(n + 1)
  + }
  + })
  + .expect("impossible since the above closure must return Some(number)");
  + format!("GlobalRt-{}", id)
  + })
  .build()
  .expect("ckb runtime initialized");
  @@ -62,7 +90,7 @@ pub fn new_global_runtime() -> (Handle, StopHandler<()>) {
  let (tx, rx) = oneshot::channel();
  let thread = thread::Builder::new()
  - .name("ckb-global-runtime-tb".to_string())
  + .name("GlobalRtBuilder".to_string())
  .spawn(move || {
  let ret = runtime.block_on(rx);
  debug!("global runtime finish {:?}", ret);
  