mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
refactor: restructure PTP client to use thread-safe runtime and RNG
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
parent
d6ca055170
commit
7b4deb1cf8
2 changed files with 10 additions and 7 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -67,13 +67,15 @@ async fn main() {
|
|||
});
|
||||
}
|
||||
|
||||
// 5️⃣ Spawn PTP client task
|
||||
// 5️⃣ Spawn PTP client thread (blocking, not async)
|
||||
{
|
||||
let ptp_state = ltc_state.clone();
|
||||
let config_clone = config_arc.clone();
|
||||
tokio::spawn(async move {
|
||||
println!("🚀 PTP task launched");
|
||||
start_ptp_client(ptp_state, config_clone).await;
|
||||
thread::spawn(move || {
|
||||
println!("🚀 PTP thread launched");
|
||||
// Create a new tokio runtime for this thread
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
rt.block_on(start_ptp_client(ptp_state, config_clone));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue