Handling shared state between actix and a parallel thread
Answering your questions:

Depends on the nature of the error.

Panics will make the thread exit. If the creator called join on the result of thread::spawn, the result of that join will be Err(boxed_any). The boxed_any is the argument given to panic!. This is one common way to signal and handle an error.
If the panic occurs while a mutex's lock is in scope, the mutex will be poisoned and therefore return Err for all locking attempts on all threads indefinitely.
In case you'd like to notify another thread about an event, let's say, an occurence of a meaningful error, it's best to use channels. You can read more in &quot;Using Message Passing to Transfer Data Between Threads&quot;: https://doc.rust-lang.org/book/ch16-02-message-passing.html

I'm not sure what you meant by exiting cleanly. You need the thread to run indefinitely. The thread will exit &quot;cleanly&quot; when the server is closed (and so when the main thread exits).

Minor points:

calls to Arc::clone can be simply .clone(). Quoting the docs:

// The two syntaxes below are equivalent.
let a = foo.clone();
let b = Arc::clone(&amp;foo);


the second (and last) data.clone() is unnecessary. This is often seen in code. Just pass the value.

You still have ownership of that original value. That original value can be spent by passing it to actix.

-&gt; () in a function signature is never meaningful; just cut it out.