Skip to content

Commit a3e7653

Browse files
committed
Name owned node runtime threads
Give ldk-node-created runtime workers a stable ldk-node-prefixed thread name so runtime activity is easier to identify in debuggers and logs, matching the store runtime naming convention. Co-Authored-By: HAL 9000
1 parent 2380b6f commit a3e7653

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/runtime.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ impl Runtime {
3434
Err(_) => {
3535
let mut runtime_builder = tokio::runtime::Builder::new_multi_thread();
3636
runtime_builder.enable_all();
37+
runtime_builder.thread_name_fn(|| {
38+
static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0);
39+
let id = ATOMIC_ID.fetch_add(1, Ordering::SeqCst);
40+
format!("ldk-node-runtime-{}", id)
41+
});
3742
// Eager driver handoff lets Tokio move the I/O driver to another worker sooner
3843
// when this runtime's current worker enters `block_in_place` via `block_on`.
3944
// That marginally reduces the chance that a synchronous caller blocks the same

0 commit comments

Comments
 (0)