Repository: actix/actix (language: rust)

Issue:
Configurable stacksize for threads started via SyncArbiter
I'd like to configure stack size(and probably give threads names), afaik it's currently not possible.


Discussion / hints:
Hi, I'd like to take this ticket. I would need some help. @robjtede. If  understand the ask correctly for configuring the stack size, would extending the struct SyncAribter for threads field suffice?
```
pub struct SyncArbiter<A>
where
    A: Actor<Context = SyncContext<A>>,
{
    queue: Option<cb_channel::Sender<Envelope<A>>>,
    msgs: AddressReceiver<A>, 
    threads:usize
}
```
And adding a corresponding set_stack_size method on the impl? And thanks in advance :)
@nickx720 have you tried asking on Discord?
I'm hitting this issue on debug builds which makes development incredibly painful as I need to do a release build which takes many minutes.

Fix patch:
diff --git a/actix/CHANGES.md b/actix/CHANGES.md
index 605d1ecf2..d62ed269f 100644
--- a/actix/CHANGES.md
+++ b/actix/CHANGES.md
@@ -4,6 +4,7 @@
 
 ### Added
 
+- Add `SyncArbiter::start_with_thread_builder()`.
 - Derive `PartialEq` and `Eq` for `MailboxError`.
 - Minimum supported Rust version (MSRV) is now 1.65.
 
diff --git a/actix/src/sync.rs b/actix/src/sync.rs
index 7cd56588d..e9034134e 100644
--- a/actix/src/sync.rs
+++ b/actix/src/sync.rs
@@ -109,6 +109,24 @@ where
     pub fn start<F>(threads: usize, factory: F) -> Addr<A>
     where
         F: Fn() -> A + Send + Sync + 'static,
+    {
+        Self::start_with_thread_builder(threads, thread::Builder::new, factory)
+    }
+
+    /// Start a new `SyncArbiter` with specified number of worker threads.
+    /// Each worker thread is spawned from the [`std::thread::Builder`]
+    /// returned by a new call to `thread_builder_factory`.
+    /// Returns a single address of the started actor. A single address is
+    /// used to communicate to the actor(s), and messages are handled by
+    /// the next available Actor in the `SyncArbiter`.
+    pub fn start_with_thread_builder<F, BF>(
+        threads: usize,
+        mut thread_builder_factory: BF,
+        factory: F,
+    ) -> Addr<A>
+    where
+        F: Fn() -> A + Send + Sync + 'static,
+        BF: FnMut() -> thread::Builder,
     {
         let factory = Arc::new(factory);
         let (sender, receiver) = cb_channel::unbounded();
@@ -120,10 +138,12 @@ where
             let actor_queue = receiver.clone();
             let inner_rx = rx.sender_producer();
 
-            thread::spawn(move || {
-                System::set_current(sys);
-                SyncContext::new(f, actor_queue, inner_rx).run();
-            });
+            thread_builder_factory()
+                .spawn(move || {
+                    System::set_current(sys);
+                    SyncContext::new(f, actor_queue, inner_rx).run();
+                })
+                .expect("failed to spawn thread");
         }
 
         System::current().arbiter().spawn(Self {


Test patch: