Here I thought I was some rust hotshot but then I need to share a mutable value between threads.

`Arc<Option<Mutex<TunnelManager>>>` is one hell of a type. :P

`Mutex<Option<TunnelManager>>`

is a lot more reasonable. :P

```
{
let mut tunnels1 = tunnels1.lock().await.unwrap();
tunnels1.open_tunnel(route_id).await?
}
```

Ain't it funky

Coding in rust makes me feel so stupid :P

It seems I need to place the mutex into an arc after all?

Follow

@dan_ballard I like the feeling tbh. It means that when I get stuff working I've learned some new skills or new ways of thinking I can apply for future problems.

I think the tool I'll use here is to structure what I want like coroutines and leverage channels for the inter-thread messaging.

Sign in to participate in the conversation
Mauvestodon

Escape ship from centralized social media run by Mauve.