Macro spawn_threads

Source
macro_rules! spawn_threads {
    ($manager:expr, $shared_data:expr, { $($name:ident: $func:expr),* }) => { ... };
}
Expand description

Macro for simplified thread spawning

This macro simplifies spawning multiple threads with the same shared data. It creates a vector of thread configurations and calls spawn_multiple.

§Syntax

spawn_threads!(manager, shared_data, { name: function, ... })

§Arguments

  • manager - The ThreadManager instance
  • shared_data - The ThreadShare data to share
  • { name: function, ... } - Named thread functions

§Returns

Result<(), String> from spawn_multiple.

§Performance

  • Compile-time expansion: No runtime overhead
  • Efficient spawning: Same performance as manual spawn_multiple
  • Type safety: Compile-time type checking
  • Memory usage: No additional allocations